2

I'm get the Hard Disk serial number with "hdparm, sdparm, /sbin/udevadm and lshw" is possible in a physical drive, but when i use the "Hyper-V" i don't have the serial number. How i can get the serial number from hard disk in this environment of virtualization or any other number to identify the hard disk how unique?

My tries:

sdparm -li /dev/sda

   /dev/sda: Msft      Virtual Disk      1.0
Device identification [0x83] VPD page:
  Addressed logical unit:
    designator type: T10 vendor identification,  code set: Binary
      vendor id: MSFT
      vendor specific: ▒▒▒H▒F▒▒"?▒LQ▒
    designator type: NAA,  code set: Binary
      NAA 6, IEEE Company_id: 0x2248
      Vendor Specific Identifier: 0x83119188
      Vendor Specific Identifier Extension: 0x4897223f824c51fe
      [0x60022480831191884897223f824c51fe]

hdparm -i /dev/sda

/dev/sda:
SG_IO: bad/missing sense data, sb[]:  70 00 00 00 00 00 00 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 HDIO_GET_IDENTITY failed: Invalid argument

hdparm -I /dev/sda

/dev/sda:
SG_IO: bad/missing sense data, sb[]:  70 00 00 00 00 00 00 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

ATA device, with non-removable media
Standards:
        Likely used: 1
Configuration:
        Logical         max     current
        cylinders       0       0
        heads           0       0
        sectors/track   0       0
        --
        Logical/Physical Sector size:           512 bytes
        device size with M = 1024*1024:           0 MBytes
        device size with M = 1000*1000:           0 MBytes
        cache/buffer size  = unknown
Capabilities:
        IORDY not likely
        Cannot perform double-word IO
        R/W multiple sector transfer: not supported
        DMA: not supported
        PIO: pio0

/sbin/udevadm info --query=property --name=sda

DEVLINKS=/dev/disk/by-id/scsi-360022480831191884897223f824c51fe /dev/disk/by-id/wwn-0x60022480831191884897223f824c51fe /dev/disk/by-path/acpi-VMBUS:00-scsi-0:0:0:0
DEVNAME=/dev/sda
DEVPATH=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/device:07/VMBUS:00/vmbus_0_1/host2/target2:0:0/2:0:0:0/block/sda
DEVTYPE=disk
ID_BUS=scsi
ID_MODEL=Virtual_Disk
ID_MODEL_ENC=Virtual\x20Disk\x20\x20\x20\x20
ID_PART_TABLE_TYPE=dos
ID_PATH=acpi-VMBUS:00-scsi-0:0:0:0
ID_PATH_TAG=acpi-VMBUS_00-scsi-0_0_0_0
ID_REVISION=1.0
ID_SCSI=1
ID_SERIAL=360022480831191884897223f824c51fe
ID_SERIAL_SHORT=60022480831191884897223f824c51fe
ID_TYPE=disk
ID_VENDOR=Msft
ID_VENDOR_ENC=Msft\x20\x20\x20\x20
ID_WWN=0x6002248083119188
ID_WWN_VENDOR_EXTENSION=0x4897223f824c51fe
ID_WWN_WITH_EXTENSION=0x60022480831191884897223f824c51fe
MAJOR=8
MINOR=0
SUBSYSTEM=block
UDEV_LOG=3
USEC_INITIALIZED=90937344

lshw -class disk

  *-cdrom
       description: DVD reader
       physical id: 0.0.0
       bus info: scsi@1:0.0.0
       logical name: /dev/cdrom
       logical name: /dev/dvd
       logical name: /dev/sr0
       capabilities: audio dvd
       configuration: status=nodisc
  *-disk
       description: SCSI Disk
       physical id: 0.0.0
       bus info: scsi@2:0.0.0
       logical name: /dev/sda
       size: 8GiB (8589MB)
       capabilities: partitioned partitioned:dos
       configuration: sectorsize=512 signature=00077a0d

Some have returned many data ('/sbin/udevadm and lshw'), but not know if i can use to identify how unique, even the number that changes every formatting me would be useful in this case.

0

These two should be enough to identify the same disk, even usually in virtualized environment.

DEVLINKS=/dev/disk/by-id/scsi-360022480831191884897223f824c51fe /dev/disk/by-id/wwn-0x60022480831191884897223f824c51fe
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.