Help Center/ Elastic Volume Service/ User Guide (Paris Region)/ FAQ/ Attachment/ How Do I Obtain My Disk Device Name in the ECS OS Using the Device Identifier Provided on the Console?
Updated on 2024-03-26 GMT+08:00

How Do I Obtain My Disk Device Name in the ECS OS Using the Device Identifier Provided on the Console?

Scenarios

You find that the device name displayed in the ECS OS is different from that displayed on the management console and you cannot determine which disk name is correct. This section describes how to obtain the disk name used in an ECS OS according to the device identifier on the console.

For details about how to attach disks, see Attach an EVS Disk.

Using a Serial Number to Obtain the Disk Name (Windows)

If a serial number is displayed on the console, use either of the following methods to obtain the disk name.

cmd

  1. Start cmd in a Windows OS as an administrator and run either of the following commands:

    wmic diskdrive get serialnumber

    wmic path win32_physicalmedia get SerialNumber

    wmic path Win32_DiskDrive get SerialNumber

    A serial number is the first 20 digits of a disk UUID.

    For example, if the serial number of a VBD disk on the console is 97c876c0-54b3-460a-b, run either of the following commands to obtain the serial number of the disk on the ECS OS:

    wmic diskdrive get serialnumber

    wmic path win32_physicalmedia get SerialNumber

    wmic path Win32_DiskDrive get SerialNumber

    Information similar to the following is displayed:

    Figure 1 Obtaining the disk serial number
  2. Run the following command to check the disk corresponding to the serial number:

    wmic diskdrive get Name, SerialNumber

    Figure 2 Checking the disk corresponding to the serial number

PowerShell

  1. Start PowerShell as an administrator in a Windows OS.
  2. Run the following command to check the disk on which the logical disk is created:
    • Windows Server 2012 or later
      1. Run the following command to check the disk on which the logical disk is created:

        Get-CimInstance -ClassName Win32_LogicalDiskToPartition |select Antecedent, Dependent |fl

        As shown in Figure 3, the disk is Disk 0.

      2. Run the following command to view the mapping between the serial number and the disk:

        Get-Disk |select Number, SerialNumber

        As shown in Figure 3, the disk is Disk 0.

        Figure 3 Viewing the disk on which the logical disk is created
    • Versions earlier than Windows 2012
      1. Run the following command to check the disk on which the logical disk is created:

        Get-WmiObject -Class Win32_PhysicalMedia |select Tag, Serialnumber

      2. Run the following command to view the mapping between the serial number and the disk:

        Get-WmiObject -Class Win32_LogicalDiskToPartition |select Antecedent, Dependent |fl

Background

Disk information displayed varies according to the ECS virtualization type. For the sake of convenience, ECSs that use the KVM virtualization type are called KVM instances, and ECSs that use the Xen virtualization type are called Xen instances.

Obtaining the Disk Device Name of a KVM Instance

  1. Obtain the disk information displayed on the console.

    1. Log in to the management console.
    2. Under Computing, click Elastic Cloud Server.
    3. Click the target ECS name in the ECS list.

      The page providing details about the ECS is displayed.

    4. Click the Disks tab and then to expand the disk information.
    5. Check the device type and ID of the disk.
      • If the device type is VBD, go to 2.
      • If the device name is SCSI, go to 3.

      If Device Identifier is not displayed on the web page, stop the ECS and restart it.

  2. Check the device name of a VBD disk attached to the ECS.

    1. Obtain the disk device ID by referring to 1.

      The device ID of the VBD disk shows the PCI address of the disk on the ECS. The address is in the format of "domain:bus:slot.function".

    2. Log in to the ECS as user root.
    3. In /sys/bus/pci/devices/DOMIN:BUS:SLOT.FUNCTION/virtio*/block, view the device name.

      For example, if the device ID of the VBD disk is 0000:00:05.0, the device name is shown as follows:

      A90CF6C6-BEC0-0C44-8082-8C8610755B61:/sys/bus/pci/devices/0000:00:05.0/virtiol/block # ll /sys/bus/pci/devices/0000:00:05.0/virtio1/block total 0
      drwxr-xr-x 10 root root 0 May 22 11:01 vda

      The displayed information is the disk device name, /dev/vda in the preceding figure.

  3. Check the device name of a SCSI disk attached to the ECS.

    1. Obtain the disk device ID by referring to 1.

      The device ID of the SCSI disk displays the disk WWN on the ECS.

    2. Log in to the ECS as user root.
    3. Run the following command to view the disk device name:

      ll /dev/disk/by-id |grep WWN|grep scsi-3

      [root@host-192-168-133-148 block]# ll /dev/disk/by-id/ |grep 6888603000008b32fa16688d09368506 |grep scsi-3
      lrwxrwxrwx 1 root root  9 May 21 20:22 scsi-36888603000008b32fa16688d09368506 -> ../../sda

Obtaining the Disk Device Name of a Xen Instance

  1. Obtain the disk information displayed on the console.

    1. Log in to the management console.
    2. Under Computing, choose Elastic Cloud Server.
    3. Click the target ECS name in the ECS list.

      The ECS details page is displayed.

    4. Click the Disks tab and then to expand the disk information.
    5. Check the device name, type, and ID of the disk.
      • If the device type is VBD, go to 2.
      • If the device name is SCSI, go to 3.

      If Device Identifier is not displayed on the page, stop the ECS and restart it.

  2. Check the device name attached to the VBD disk in the ECS.

    For a VBD disk, the device name displayed on the management console corresponds to the disk device name in the ECS OS. For details, see ECS.

    Table 1 Mapping between disk device names displayed on the management console and those obtained on the ECS

    Device Name (on Management Console)

    Device Name (in ECS)

    /dev/sd***

    /dev/xvd***

    /dev/vd***

    /dev/xvd***

    /dev/xvd***

    /dev/xvd***

    An example is provided as follows:

    If the device name displayed on the management console is /dev/sdb, the device name of the device attached to the ECS is /dev/xvdb.

  3. Check the device name of the SCSI disk attached to the ECS.

    1. Obtain the disk device ID.

      The device ID of the SCSI disk is the disk WWN on the ECS.

    2. Log in as user root.
    3. Run the following command to view the disk device name:

      ll /dev/disk/by-id |grep WWN|grep scsi-3

      [root@host-192-168-133-148 block]# ll /dev/disk/by-id/ |grep 6888603000008b32fa16688d09368506 |grep scsi-3
      lrwxrwxrwx 1 root root  9 May 21 20:22 scsi-36888603000008b32fa16688d09368506 -> ../../sda