2

There are several hard disk partitions on my system (Linux josDeb 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3.1 (2019-02-19) x86_64 GNU/Linux). It is working with:

bejo@josDeb:~$ ls -l /dev/disk/by-uuid

yields:

total 0
lrwxrwxrwx 1 root root 10 Apr 13 16:20 00FB-604A -> ../../sdb1
lrwxrwxrwx 1 root root 10 Apr 13 16:19 4425-7572 -> ../../sda1
lrwxrwxrwx 1 root root 10 Apr 13 16:19 8dc07aba-5729-4525-883f-09c32d1a9e98 -> ../../sda2
lrwxrwxrwx 1 root root 10 Apr 13 16:19 95a8efff-92d2-4e31-8632-bf7a640e100f -> ../../sda3
lrwxrwxrwx 1 root root 10 Apr 13 16:19 f5a05b5e-c3ed-4227-bb62-fe4576b72643 -> ../../sda4

Some partition uuids are long, and some are short. I would like to understand why. I thought, uuids always have 16 bytes. How come I have uuids of different sizes?

6

Actual UUIDs are supposed to be 128-bit long and meant to be unique. Prior to this, various systems provided various serial numbers of various size to be distinguishable. So Linux just takes whatever serial it can find and sticks them in the /dev/by-uuid/ directory even if they aren't matching the UUID definition. That's the case for the FAT32 volume ID:

Sector offset   FAT32 EBPB offset   Length (bytes)  Contents 
0x043           0x38                4               Cf. 0x027 for FAT12/FAT16 (Volume ID) 

Historical description:

Volume ID (serial number)

Typically the serial number "xxxx-xxxx" is created by a 16-bit addition of both DX values returned by INT 21h/AH=2Ah (get system date)[nb 7] and INT 21h/AH=2Ch (get system time)[nb 7] for the high word and another 16-bit addition of both CX values for the low word of the serial number. Alternatively, some DR-DOS disk utilities provide a /# option to generate a human-readable time stamp "mmdd-hhmm" build from BCD-encoded 8-bit values for the month, day, hour and minute instead of a serial number.

This is a 32 bits value, which can be displayed for example as 4425-7572. Most likely those two partitions are EFI System partitions since they have to be FAT32.

You can get better informations (probably coming from parsing several /dev/disks/by-*/ entries) with the blkid command instead:

# blkid

or limited to those short entries:

# blkid /dev/sda1 /dev/sdb1

The manual suggest to use lsblk instead which doesn't require root. So with the right options that would be lsblk -o +UUID,FSTYPE /dev/sda1 /dev/sdb1.

E.g. here:

$ lsblk -o +UUID,FSTYPE /dev/sda1 /dev/sdb1
NAME MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT UUID                                 FSTYPE
sda1   8:1    0  200M  0 part /boot/efi  1234-5678                            vfat
sdb1   8:17   1  200M  0 part            9ABC-DEF0                            vfat
  • Thanks - understood. In my case sda1 indeed is a fat32 partition whereas sdb1 is an exfat partition. – bejo Apr 13 at 15:51
  • So for this one that would be VolumeSerialNumber here, also 4 bytes. – A.B Apr 13 at 16:06

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.