Are disk labels sda/sdb/sdc/... tied to physical ports?
I'm wondering if disk labels like sda/sdb/sdc/... are associated with physical ports on the mainboard? For instance, if I have sda/sdb/sdc and remove the first 2 disks, will sdc become sda or will it stay sdc? Is the principle behind assigning disk labels documented somewhere?
No.
udev
drive identifiers are done in multiple ways, but they are allocated dynamically on bootup and therefore they will change if you unplug devices (or even if one just happens to spin up slower one day). Slightly more consistent than this is /dev/by-path
which will give you a path by connection to the machine, e.g. PCI bus -> Card 0 -> Port 2 (so long as the chip maintains consistent numbering, which isn't guaranteed in all cases).
However, if you want almost perfectly consistent devices*, use their UUID by calling blkid
on the partition (like blkid /dev/sda1
) and then use that in your mount options or /etc/fstab
with UUID=
If you did this as a recent installation, then you should already see an example of this in your /etc/fstab
.
*Consistency is not guaranteed if you bitwise-copy (e.g. dd
) an entire device or partition because it copies the UUID as well. You'll have to change the UUID if you want to use both copies in the same machine. Use the applicable partition or file system management tool for such a change.