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
.
EDIT
The 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 -a
ATTRS{model}=="Samsung SSD 840 "
ATTRS{vendor}=="0x8086"
ATTRS{class}=="0x010700"
ATTRS{device}=="0x1d6b"
....
How can I generate a UUID
from these attributes, so that same Model/Manufacturer disk will have the same UUID
?
/dev/sda
a fixed name instead.