Help Center/ Elastic Cloud Server/ User Guide (Kuala Lumpur Region)/ FAQs/ Disk Management/ Others/ Why Is the Device Name of My C6 ECS in the sd* Format?
Updated on 2024-04-19 GMT+08:00

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 -l
    
    Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors
    Units = sectors of 1 x 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk label type: dos
    Disk identifier: 0x000bcb4e
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/vda1   *        2048    83886079    41942016   83  Linux
    
    Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
    Units = sectors of 1 x 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes

    This 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 How Do I Obtain My Disk Device Name in the ECS OS Using the Device Identifier Provided on the Console?.

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. Use the UUID of the file system to configure automatic mounting for a system disk.

  • 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.
    • If Enable automatic configuration is not selected when you are creating a private image, see Changing the Disk Identifier in the fstab File to UUID.