Why Is the Device Name of My C6 ECS in the sd* Format?
Symptom
The device name of previously purchased C6 ECSs is in vd* format, for example, vda and vdb, but the device name of newly purchased C6 ECSs is in sd* format.
This section describes the reason why the device name is changed to the sd* format and how to handle the sd* device name in common scenarios.
Root Cause
The device name of the Linux system is automatically generated based on certain rules that are related to the disk protocol and disk sequence number, which brings some uncertainties. When disks are attached to C6 ECSs, either virtio-blk or virtio-scsi is used.
- If virtio-blk is allocated, the device name format is vd*.
- If virtio-scsi is allocated, the device name format is sd*.
Disk Partitioning and Formatting
Problem: Before using an ECS for the first time, you need to partition or format the attached data disks. If the ECS device name is in sd* format, running /dev/vd* will fail.
Solution: Dynamically obtain the device name and then perform operations on the disk. You can dynamically obtain device names in either of the following ways:
- Method 1: Run fdisk to query the device name.
Log in to the ECS and run the following command to query the data disk list:
fdisk -l
Information similar to the following is displayed, indicating the ECS has two disks attached. /dev/vda is the system disk, and /dev/vdb is the new data disk.
[root@ecs-test-0001 ~]# fdisk -lDisk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectorsUnits = sectors of 1 × 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x000bcb4eDevice Boot Start End Blocks Id System/dev/vda1 * 2048 83886079 41942016 83 LinuxDisk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 sectorsUnits = sectors of 1 × 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesThis is a convenient method to obtain the device name, but you cannot obtain the mapping between the EVS disks attached to the ECS and the device names in the OS. If you want to know the mapping, obtain the device name by referring to method 2.
- Method 2: Use serial-id or wwn to obtain the device name.
For details, see .
Automatic Mounting of File Systems
You are advised to use UUIDs to identify disks in the file because they are unique identifiers for disk partitions and do not change with device names.
- Automatic Mounting for a System Disk
- If a public image or a private image created from a public image is used, UUIDs are used for automatic disk mounting and no action is required.
- If a private image created using a non-public image is used, select Enable automatic configuration when creating the image. Then, the system automatically uses UUIDs for automatic disk mounting.
- Symptom
- Root Cause
- Disk Partitioning and Formatting
- Automatic Mounting of File Systems