What Is the Mapping Between Device Names and Disks?
Scenarios
After users logged in to a Linux ECS and viewed disk information, they found that the disk device names were different from those displayed on the management console and could not identify the ECS to which a specified disk was attached. This section describes how to obtain the device name used on an ECS according to the disk information displayed on the management console.
Obtaining the Disk ID of an ECS on the Management Console
- Log in to the management console.
- Under Computing, click Elastic Cloud Server.
- Click the target ECS name in the ECS list.
- Click the Disks tab and then
to expand the disk information. - Check the device type and ID of the disk.
If Device Identifier is not displayed on the web page, stop the ECS and restart it.
- If Device Type is VBD, use a serial number or BDF to obtain the disk device name. (Kunpeng ECSs support only serial numbers.)
To use a serial number, see Using a Serial Number to Obtain a Disk Device Name.
To use a BDF, see Using a VBD to Obtain a Disk Device Name.
- If Device Type is SCSI, use a WWN to obtain the disk device name. For details, see Using a WWN to Obtain a Disk Device Name.
- If Device Type is VBD, use a serial number or BDF to obtain the disk device name. (Kunpeng ECSs support only serial numbers.)
Using a Serial Number to Obtain a Disk Device Name
If a serial number is displayed on the management console, run either of the following commands to obtain the device name.
A serial number is the first 20 digits of the disk UUID.
For example, if the serial number of the VBD disk is 62f0d06b-808d-480d-8, run either of the following commands:
# udevadm info --query=all --name=/dev/xxx | grep ID_SERIAL
# ll /dev/disk/by-id/*
Or:
# udevadm info --query=all --name=/dev/vdb | grep ID_SERIAL
# ll /dev/disk/by-id/*
The following information is displayed:
[root@ecs-ab63 ~]# udevadm info --query=all --name=/dev/vdb | grep ID_SERIAL E: ID_SERIAL=62f0d06b-808d-480d-8 [root@ecs-ab63 ~]# ll /dev/disk/by-id/* lrwxrwxrwx 1 root root 9 Dec 30 15:56 /dev/disk/by-id/virtio-128d5bfd-f215-487f-9 -> ../../vda lrwxrwxrwx 1 root root 10 Dec 30 15:56 /dev/disk/by-id/virtio-128d5bfd-f215-487f-9-part1 -> ../../vda1 lrwxrwxrwx 1 root root 9 Dec 30 15:56 /dev/disk/by-id/virtio-62f0d06b-808d-480d-8 -> ../../vdb
The displayed information is the disk device name, /dev/vdb in the preceding terminal display.
Using a VBD to Obtain a Disk Device Name
- Run the following command to use a BDF to obtain the device name:
ll /sys/bus/pci/devices/BDF disk ID/virtio*/block
For example, if the BDF disk ID of the VBD disk is 0000:02:02.0, run the following command to obtain the device name:
ll /sys/bus/pci/devices/0000:02:02.0/virtio*/block
The following information is displayed:
[root@ecs-ab63 ~]# ll /sys/bus/pci/devices/0000:02:02.0/virtio*/block total 0 drwxr-xr-x 8 root root 0 Dec 30 15:56 vdb
The displayed information is the disk device name, /dev/vdb in the preceding terminal display.
Using a WWN to Obtain a Disk Device Name
- Log in to the ECS as user root.
- Run the following command to view the disk device name:
ll /dev/disk/by-id |grep WWN|grep scsi-3
For example, if the WWN obtained on the management console is 6888603000008b32fa16688d09368506, run the following command:
ll /dev/disk/by-id |grep 6888603000008b32fa16688d09368506|grep scsi-3
The following information is displayed:
[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
- Obtain the disk information displayed on the management console.
- Log in to the management console.
- Under Computing, click Elastic Cloud Server.
- Click the target ECS name in the ECS list.
- Click the Disks tab and then
to expand the disk information. - Check the device name, type, and ID of the disk.
If Device Identifier is not displayed on the web page, stop the ECS and restart it.
- Check the device name of a VBD disk on the ECS.
For a VBD disk, the device name displayed on the management console corresponds to the disk device name viewed on the ECS. For details, see Table 1.
Table 1 Mapping between disk device names displayed on the management console and those obtained on the ECS Device Name (Management Console)
Device Name (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.
- Check the device name of a SCSI disk on the ECS.
- Obtain the disk device ID.
The device ID of the SCSI disk displays the disk WWN on the ECS.
- Log in to the ECS as user root.
- 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
- Obtain the disk device ID.
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.