Serial numbers can be used as unique IDs for cloud disks and local disks in an operating system to identify and distinguish different disks. This topic describes how to query the serial numbers of disks in Linux and Windows operating systems.

Limits

When you query serial numbers, take note of the following limits:
  • You can query the serial numbers of disks that are created only on or after June 10, 2020.
  • You can query the serial numbers of disks only on I/O optimized instances.
  • You can query the serial numbers of cloud disks, including enhanced SSDs (ESSDs), SSDs, ultra disks, and basic disks.
  • You can query the serial numbers of local disks, including NVMe SSDs and SATA HDDs.

Query the serial number of a disk in Linux

  1. Connect to an ECS instance.
    For more information about connection methods, see Connection methods.
  2. Run the lsblk command to query the device names of the Elastic Block Storage (EBS) devices that are attached to an instance.
    [root@ecs ~]# lsblk
    NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    vdb    254:16   0  20G  0 disk
    vda    254:0    0  40G  0 disk
  3. Run the following command to query the serial number of an EBS device:
    udevadm info --query=all --name= Device name | grep ID_SERIAL

    For example, you can use the following command to query the serial number of the /dev/vda device:

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

Query the serial number of a disk in Windows Server 2012 or later

  1. Connect to an ECS instance.
    For more information about connection methods, see Connection methods.
  2. Open Windows PowerShell.
    Open the Start menu, enter PowerShell in the search field, and then click Windows PowerShell.
  3. Run the following command to query the disk corresponding to a logical volume (LV):
    Get-CimInstance -ClassName Win32_LogicalDiskToPartition |select Antecedent, Dependent |fl

    Example:

    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. Run the following command to query the serial number of the disk:
    Get-Disk |select Number, SerialNumber

    Example:

    PS C:\Users\Administrator> Get-Disk |select Number, SerialNumber
    
    Number SerialNumber
    ------ ------------
         1 bp14dzwwr539hzqi****
         0 bp16htuqeqnvlee8****

Query the serial number of a disk in an operating system earlier than Windows Server 2012

  1. Connect to an ECS instance.
    For more information about connection methods, see Connection methods.
  2. Open Windows PowerShell.
    Open the Start menu, enter PowerShell in the search field, and then click Windows PowerShell.
  3. Run the following command to query the disk corresponding to an LV:
    Get-WmiObject -Class Win32_LogicalDiskToPartition |select Antecedent, Dependent |fl

    Example:

    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:"
  4. Run the following command to query the serial number of the disk:
    Get-WmiObject -Class Win32_PhysicalMedia |select Tag, Serialnumber

    Example:

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