On my system (Debian), I can see the UUID identifier for all of my disks partitions (i.e. /dev/sda1, dev/sda2, ..)ls /dev/disk/by-uuid/However, I don't see the UUID identifier for /dev/sda itself. Is it possible to reference whole disk with UUID?I need this because I want to reference a particular disk, and I cannot rely it will be called /dev/sda.EDITThe solution suggested by @don_crissti is great. However, I would like the UUID to be the same for all hard disks of the same Model/Manufacturer, not unique by serial number.Using udevadm, I can see the disk attributes:udevadm info -n /dev/sda -aATTRS{model}==Samsung SSD 840 ATTRS{vendor}==0x8086ATTRS{class}==0x010700ATTRS{device}==0x1d6b....How can I generate a UUID from these attributes, so that same Model/Manufacturer disk will have the same UUID ?
reference whole disk (/dev/sda) using UUID
udev;disk;fdisk;uuid
The symlinks under /dev/disk/by-uuid/ are created by udev rules based on filesystems UUIDs. If you look at /usr/lib/udev/rules.d/60-persistent-storage.rules you will find entries like:...... ENV{ID_FS_UUID_ENC}==?*, SYMLINK+=disk/by-uuid/$env{ID_FS_UUID_ENC}To reference a disk you could use the disk serial number and the ENV{ID_SERIAL_SHORT} key.The following udev rule matches the drive with serial no. 0000000013100925DB96 and creates a symlink with the same name under /dev/disk/by-uuid/:KERNEL==sd*, SUBSYSTEM==block, ENV{DEVTYPE}==disk, ENV{ID_SERIAL_SHORT}==0000000013100925DB96, SYMLINK+=disk/by-uuid/$env{ID_SERIAL_SHORT}As to your other question... sure, you could always use ENV{ID_MODEL} instead of ENV{ID_SERIAL_SHORT} and use a custom string for your symlink name.The following rule matches any drive with ID_MODEL = M4-CT128M4SSD2 and creates a symlink M4-SSD-1234567890 under /dev/disk/by-uuid/:KERNEL==sd*, SUBSYSTEM==block, ENV{DEVTYPE}==disk, ENV{ID_MODEL}==M4-CT128M4SSD2, SYMLINK+=disk/by-uuid/M4-SSD-1234567890Note that this works fine as long as there's only one drive matching the ID_MODEL. If there are multiple drives of the same model, the rule is applied again for each of them and the symlink will point to the last detected/added drive.