VKE clusters allow you to specify the underlying attributes and features of a PV during formatting by using formatting parameters when you mount the PV in a pod. This topic describes how to specify formatting parameters when you use EBS volumes.
What are formatting parameters
Formatting parameters are specified when a file system is created (formatted) for the first time. The parameters are mainly used to specify the underlying attributes, performance, features, and adaptation logic of the file system, and replace the default format configuration. This ensures the file system is precisely adapted to business scenarios, such as small file storage, high I/O read/write operations, and large-capacity disks. It also ensures storage efficiency and data adaptability.
The following table describes common usage scenarios and descriptions of formatting parameters.
Common formatting parameters
Supported formatting parameters vary depending on the file system type selected for EBS volumes.
- To specify volume formatting parameters, the csi-ebs add-on must be upgraded to v1.3.0 or later. For details, see Upgrading add-ons.
- Formatting parameters take effect only if the volume is formatted for the first time, and do not support dynamic modification.
When you configure a PersistentVolume (PV) of the EBS type, you can specify formatting parameters by using the console or kubectl.
Configuring through the console
Configuring through kubectl
- In the left navigation bar, click Cluster. Click the name of the target cluster to go to the cluster management page.
- In the left navigation bar on the cluster management page, click Storage > PersistentVolume.
- Click Create PersistentVolume and configure parameters on the page that appears. In the Advanced settings section, click Add formatting parameter to specify the formatting parameters for the PV.
- After the configuration is complete, you can create a PersistentVolumeClaim (PVC), associate it with the PV, and then mount it in the container. For details, see Using static PVs of the EBS type.
- When you configure a PV by using kubectl, you can specify formatting parameters.
- After the configuration is complete, you can create a PVC, associate it with the PV, and then mount it in the container. For details, see Using static PVs of the EBS type.
When you configure a StorageClass (SC) of the EBS type, you can specify formatting parameters by using the console or kubectl.
Configuring through the console
Configuring through kubectl
- In the left navigation bar, click Cluster. Click the name of the target cluster to go to the cluster management page.
- In the left navigation bar on the cluster management page, click Storage > StorageClass.
- Click Create StorageClass and configure parameters on the page that appears. In the Advanced settings section, click Add formatting parameter to specify the formatting parameters for the SC.
- After the configuration is complete, you can create a PVC, associate it with the SC, and then mount it in the container. For details, see Using dynamic PVs of the EBS type.
- When you configure an SC by using kubectl, you can specify formatting parameters.
- After the configuration is complete, you can create a PVC, associate it with the SC, and then mount it in the container. For details, see Using dynamic PVs of the EBS type.
If you specify formatting parameters when you create a PV of the EBS type, you can check whether the parameters take effect after the configuration is complete. This topic uses the formatting configuration mkfsOptions: "-O bigalloc -C 16384" as an example.
- Use ECS Terminal to log in to the node where the pod is located. For details, see ECS Terminal.
- Run the following command to check whether the mkfsOptions formatting parameters have taken effect. /dev/vdc is the logical identifier of the volume when it is mounted on the node.
- The expected result is as follows.
- In the Filesystem features line, the bigalloc field can be found, which indicates that the bigalloc feature of the EXT4 file system has been enabled.
- In the Block size line, the value is 4096, which indicates the default block size in the EXT4 system is 4096 bytes (4 KB). In this case, the formatting parameter -C 16384 allocates a total size of 16384 * 4096 = 64 MB for the log buffer.