Re: Disk identifiers
From: H <hidden>
Date: 2020-12-05 21:02:31
On 12/05/2020 02:08 PM, Peter Grandi wrote:
[...]quoted
I was referring to what fdisk -l calls "disk identifier". [...]That's not a very fruitful approach :-). The real disk identifiers are the serial number or WWN. What 'fdisk' reports is the identifier of the "label" (called by 'fdisk' "Disklabel", which is a metadata block which usually contains the partition table, and of which there are several types). For MBR/DOS type labels that is a pretty obscure field at offset 0x1B8 on the disk, and it is a 32b field. I personally use it to store 4 characters, but it can be any 32-bit value. That value matters a lot more to MS-Windows than to GNU/Linux, which basically ignores it. I find that value used under '/dev/disk/by-partuuid/' where it is used to prefix the number of the partition for DOS/MBR labeled disks. BTW the entries under '/dev/disk/' seem to me a "legacy" mess. GPT/EFI labels instead have 128b fields which are usually filled with UUID-structured random values, and those are not ignored and usually appear under '/dev/disk/by-uuid'. For MD raid sets I like to use GPT labels and refer to RAID set members by partition name, where I give those partitions meaningful proper-name prefixes. But that's another story.
This is the output from fdisk -l where it is called "Disk identifier": Disk /dev/sda: 256.1 GB, 256060514304 bytes, 500118192 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk label type: gpt Disk identifier: 00000000-0000-0000-0000-000000000000 and the output from another disk: Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes, 3907029168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: gpt Disk identifier: EF1A3010-0A15-5A4B-A6FC-1B0EA869D0A7 Thus the disk identifier in the first case is not, as I had mentioned seeing in my first e-mail, something like 0x12345678, but rather a UUID-like number. Should I change the disk identifier for the first disk to something else than all-zeroes? And, if so, should I use a UUID-like number since fdisk presents it as such or should I use a 8-character string? I