J'obtiens le numéro de série du disque dur avec "hdparm, sdparm, /sbin/udevadm et lshw". C'est possible pour un disque physique, mais lorsque j'utilise "Hyper-V", je n'ai pas le numéro de série. Comment puis-je obtenir le numéro de série du disque dur dans cet environnement de virtualisation ou tout autre numéro permettant d'identifier le disque dur comme étant unique ?
Mes essais :
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: HF"?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
Certains ont retourné de nombreuses données ('/sbin/udevadm and lshw'), mais je ne sais pas si je peux utiliser pour identifier le caractère unique, même le nombre qui change à chaque formatage serait utile dans ce cas.