I've noticed that Linux distributions typically have a /dev/disk/by-label directory, but this isn't always the case (For example, the CirrOS Linux test image doesn't have one).
What's required on a Linux system for the /dev/disk/by-label directory to be properly populated?
Best Answer
On most modern Linux systems, pretty much everything under
/dev
is put there by udev.On my Debian machine,
/dev/disk/by-label
comes from several files under/lib/udev/rules.d
For example, here is a rule from60-persistent-storage.rules
:A few lines earlier is where
ID_FS_LABEL_ENC
comes from:You can run
blkid
yourself to see the data its passing to udev:And indeed:
You can put additional rules files in
/etc/udev/rules.d/
if you'd like to make additional names for devices, change permissions, etc. E.g., here we have one that populates and sets the permissions on a/dev/disk/for-asm
.