Do EBS volume need to be formatted before it can be attached to a container

10/3/2020

I'm wondering if one needs to format an EBS volume (e.g. via mkfs.xfs) before it can be used by a container running in kubernetes. I've examples where in people just create the volumes and have it mounted by kubernetes. Does kubernetes format the volume before using it first?

-- Demeter P. Chen
amazon-ebs
amazon-web-services
kubernetes

1 Answer

10/5/2020

According to the official documentation:

An awsElasticBlockStore volume mounts an Amazon Web Services (AWS) EBS Volume into your Pod. Unlike emptyDir, which is erased when a Pod is removed, the contents of an EBS volume are preserved and the volume is merely unmounted. This means that an EBS volume can be pre-populated with data, and that data can be "handed off" between Pods.

So it does not have to be formatted before being used.

You can find more details and examples in the linked documentation.

-- WytrzymaƂy Wiktor
Source: StackOverflow