For a Linux ECS, the drive letter may change after an EVS disk is detached and then attached again, or after an EVS disk is detached and then the ECS is restarted.
When a Linux ECS has multiple disks attached, it allocates drive letters in the attachment sequence and names the disks as /dev/vda1, /dev/vdb1, and /dev/vdc1, etc.
After a disk is detached and then attached again, or after a disk is detached and the ECS is restarted, the drive letter may change.
For example, an ECS has three disks attached: /dev/vda1, /dev/vdb1, and /dev/vdc1. The mounting parameters in /etc/fstab are as follows:
cat /etc/fstab
UUID=b9a07b7b-9322-4e05-ab9b-14b8050bdc8a / ext4 defaults 0 1 /dev/vdb1 /data1 ext4 defaults 0 0 /dev/vdc1 /data2 ext4 defaults 0 0
After /dev/vdb1 is detached and the ECS is restarted, /dev/vdc1 becomes /dev/vdb1 and is mounted to /data. In such a case, no disk is mounted to /data2.
The change of drive letters can affect the running of applications. To solve this problem, you are advised to use the universally unique identifiers (UUIDs) to replace /dev/vdx because a UUID uniquely identifies a disk partition in the Linux OS.
In this example, run the following command to obtain the UUID of the /dev/vdb1 partition:
blkid /dev/vdb1
Information similar to the following is displayed:
[root@ecs-test-0001 ~]# blkid /dev/vdb1 /dev/vdb1: UUID="b9a07b7b-9322-4e05-ab9b-14b8050cd8cc" TYPE="ext4"
The UUID of the /dev/vdb1 partition is displayed.
vi /etc/fstab
UUID=b9a07b7b-9322-4e05-ab9b-14b8050cd8cc /data1 ext4 defaults 0 0
The parameters are defined as follows:
When this parameter is set to 1 for the root partition, this parameter for other partitions must start with 2 so that the system checks the partitions in the ascending order of the values.
The following information is displayed:
UUID=b9a07b7b-9322-4e05-ab9b-14b8050bdc8a / ext4 defaults 0 1 UUID=b9a07b7b-9322-4e05-ab9b-14b8050cd8cc /data1 ext4 defaults 0 0 UUID=b9a07b7b-9322-4e05-ab9b-14b8050ab6bb /data2 ext4 defaults 0 0