All Products
Search
Document Center

Elastic Compute Service:Query serial numbers of block storage devices

Last Updated:May 15, 2026

Use serial numbers to identify block storage devices and map them to disk IDs in Linux and Windows.

Limitations

Note the following limitations:

  • Only block storage devices created on or after June 10, 2020 have serial numbers.

  • Serial number query is supported only for I/O optimized instances or non-I/O optimized instances that expired and were migrated. To check whether an instance is I/O optimized, call the DescribeInstances operation and check the IoOptimized parameter in the response.

    Note

    Serial number query is not supported for non-I/O optimized instances that are not migrated or cloud disks created before June 10, 2020. For such instances or disks, call the DescribeDisks operation and check the Device parameter in the response.

  • Windows instances require virtio driver version 58017 or later. See Update the virtio driver for a Windows instance.

Query serial numbers

Linux

  1. Connect to an ECS instance.

    For information about the connection methods, see Connection method overview.

  2. Run sudo fdisk -lu to list block storage devices attached to the instance.

    fdisk output

    The output shows two block storage devices: system disk /dev/vda and data disk /dev/vdb.

  3. Check whether the block storage devices use the NVMe protocol.

    • Non-NVMe devices use the /dev/vd[a-z] format. Examples: /dev/vdb, /dev/vdc, and /dev/vdd.

    • NVMe devices use the /dev/nvme<X>n1 format. Examples: /dev/nvme0n1, /dev/nvme1n1, and /dev/nvme2n1. See NVMe protocol.

  4. Query the serial number of a block storage device.

    • For a non-NVMe block storage device, run the following command to query the serial number:

      udevadm info --query=all --name=<Name of the block storage device> | grep ID_SERIAL

      In this example, the serial number of /dev/vda is queried. The ID_SERIAL value in the output is the serial number: bp1d4foh3ef8bntl****.

      [ecs-user@ecs ~]$ udevadm info --query=all --name=/dev/vda | grep ID_SERIAL
      E: ID_SERIAL=bp1d4foh3ef8bntl****

      If the udevadm command does not return the serial number, use lsblk instead:

      sudo lsblk --output=NAME,SERIAL | grep <Name of the block storage device>

      In this example, the serial number of /dev/vdb is queried. The output shows the serial number: bp1eu6cpm9msq70b****.

      [ecs-user@ecs ~]$ sudo lsblk --output=NAME,SERIAL | grep vdb
      vdb    bp1eu6cpm9msq70b****
    • For an NVMe block storage device, run the following commands to query the serial number.

      1. Install the nvme-cli tool. The installation command varies by operating system.

        Alibaba Cloud Linux 2, Alibaba Cloud Linux 3, or CentOS 6 or later

        Note

        CentOS 6 reached end of life (EOL). In accordance with Linux community rules, all content was removed from the following CentOS 6 repository address: http://mirror.centos.org/centos-6/. If you continue to use the default CentOS 6 repository on Alibaba Cloud, an error is reported. To use specific installation packages of CentOS 6, change the CentOS 6 repository address. For more information, see How do I change CentOS 6 repository addresses?

        sudo yum install nvme-cli -y

        Debian 9 or later, or Ubuntu 14 or later

        Important

        Debain9 and Debain10 reached their EOL. If your instance runs Debain9 or Debain10, change the repository addresses of the operating system. See Change repository addresses after CentOS or Debian reached its EOL.

        sudo apt-get update
        sudo apt-get install nvme-cli -y
      2. Query the serial number:

        sudo nvme id-ctrl <Name of the block storage device> |grep "sn"

        In this example, the serial number of /dev/nvme1n1 is queried. The sn value in the output is the serial number: bp1bmed6djhiibh*****.

        [ecs-user@ecs ~]$ sudo nvme id-ctrl /dev/nvme1n1 |grep "sn"
        
        sn        : bp1bmed6djhiibh*****

Windows

  • Windows Server 2012 or later

    1. Connect to an ECS instance.

      For information about the connection methods, see Connection method overview.

    2. Open Windows PowerShell.

      Enter PowerShell in the search box next to the Start icon and then click Windows PowerShell.

    3. Query the block storage devices corresponding to logical volumes (LVs):

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

      View the Disk # values for each LV. The output shows that Disk C corresponds to Disk #0 and Disk D corresponds to Disk #1.

      PS C:\Users\Administrator> Get-CimInstance -ClassName Win32_LogicalDiskToPartition |select Antecedent, Dependent |fl
      
      Antecedent : Win32_DiskPartition (DeviceID = "Disk #0, Partition #0")
      Dependent  : Win32_LogicalDisk (DeviceID = "C:")
      
      Antecedent : Win32_DiskPartition (DeviceID = "Disk #1, Partition #0")
      Dependent  : Win32_LogicalDisk (DeviceID = "D:")
    4. Check whether block storage devices use the NVMe protocol and query their serial numbers:

      Get-Disk |select Number, SerialNumber, BusType
      • If BusType is not NVMe, the device is non-NVMe. In this example, the serial number of Disk #1 is queried. Find the value 1 in the Number column; the corresponding SerialNumber is bp14dzwwr539hzqi****.

        PS C:\Users\Administrator> Get-Disk |select Number, SerialNumber, BusType
        
        Number SerialNumber         BusType
        ------ ------------         ------- 
             1 bp14dzwwr539hzqi**** SCSI   
             0 bp16htuqeqnvlee8**** SCSI   
      • If BusType is NVMe, the device uses the NVMe protocol. In this example, the serial number of Disk #1 is queried. Find the value 1 in the Number column; the bp1heipctzsr7bhh**** part of the SerialNumber value is the serial number.

        PS C:\Users\Administrator> Get-Disk |select Number, SerialNumber
        
        Number SerialNumber                   BusType
        ------ ------------                   -------
             1 bp1heipctzsr7bhh****_00000001. NVMe
             0 bp16q98m9p2tssdt****_00000001. NVMe
        Note

        The SerialNumber value for each NVMe device consists of the serial number and a namespace ID (00000001).

  • Earlier than Windows Server 2012

    1. Connect to an ECS instance.

      For information about the connection methods, see Connection method overview.

    2. Open Windows PowerShell.

      Enter PowerShell in the search box next to the Start icon and then click Windows PowerShell.

    3. Query the block storage devices corresponding to LVs:

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

      View the Disk # values for each LV. The output shows that Disk C corresponds to Disk #0 and Disk D corresponds to Disk #1.

      PS C:\Users\Administrator> Get-WmiObject -Class Win32_LogicalDiskToPartition |select Antecedent, Dependent |fl
      
      Antecedent : \\ecs\root\cimv2:Win32_DiskPartition.DeviceID="Disk #0, Partition #0"
      Dependent  : \\ecs\root\cimv2:Win32_LogicalDisk.DeviceID="C:"
      
      
      Antecedent : \\ecs\root\cimv2:Win32_DiskPartition.DeviceID="Disk #1, Partition #0"
      Dependent  : \\ecs\root\cimv2:Win32_LogicalDisk.DeviceID="D:"
    4. Query the serial numbers:

      Get-WmiObject -Class Win32_PhysicalMedia |select Tag, Serialnumber

      In this example, the serial number of Disk #0 is queried. The output shows that the serial number of Disk #0 is bp1bet4g35opq6vq****.

      PS C:\Users\Administrator> Get-WmiObject -Class Win32_PhysicalMedia |select Tag, Serialnumber
      DeviceID           Serialnumber
      --------           ------------    
      \\.\PHYSICALDRIVE0 bp1bet4g35opq6vq****

Determine the ID of a block storage device based on the serial number

Each block storage device has an ID in the d-<Serial number> format. Use the serial number to locate the device in the ECS console.

For example, if the serial number is bp1gks8z0fh3m1z9****, the disk ID in the ECS console is d-bp1gks8z0fh3m1z9****.

image.png