UUID is shared between all partitions
rumblpak opened this issue · 4 comments
Using this blkid output, all partitions share the same uuid which causes the last partition to be the only partition listed in /dev/disk/by-uuid
. This could be fixed by using UUID_SUB like this:
KERNEL=="fio[a-z][0-9]*", ENV{DEVTYPE}=="partition", PROGRAM="/sbin/blkid -s UUID_SUB -o value /dev/%P%n", SYMLINK+="disk/by-uuid/%c"
I'm not 100% sure why this is happening locally to me but that definitely fixes populating /dev/disk/by-uuid/
for me.
@rumblpak thanks for bringing this up, I'm not a btrfs user on my fio drive so haven't encountered this!
Afaik UUID_SUB is a btrfs-ism, and is used for volumes, no other FS seems to use it(?). The solution won't work for anyone not using btrfs, as it would return empty. The solution could be to run the UUID_SUB rule before the UUID rule?
I’m actually a zfs user, still though, I’m just using fdisk to create two partitions and putting zfs on top of that. I feel like there could be a change to help both use-cases.
@rumblpak today I learned. Never noticed the UUID_SUB with blkid before for my ZFS volumes on Linux.
I do think you can add the UUID_SUB, that said it will still execute the UUID rule leaving you with the last entry as the main UUID, which probably is not desirable. In my case when testing it shows an empty for UUID_SUB, so no harm there. Getting the UUID correct icw the UUID_SUB would require some more finagling it seems.
I do think adding this before the UUID line would fix it for newer versions of udev where the :=
operator is supported:
KERNEL=="fio[a-z][0-9]*", ENV{DEVTYPE}=="partition", PROGRAM="/sbin/blkid -s UUID_SUB -o value /dev/%P%n", ENV{ID_FS_UUID_SUB}="$result", ENV{ID_FS_UUID_SUB}!="", SYMLINK:="disk/by-uuid/%c"
I've noticed that the symlinks for by-id
and by-path
aren't being created at all even though udevadm test
seems to indicate that it is doing it. 🤷♂️