harddisks_by_label

Mount Harddisks by Label in Linux

I used to mount Harddisks by UUID but this requires you to update your fstab when you copy your system to a new partition that does not have the same uuid anymore. so i eventually changed to using labels.

one big advantage of labels is also, that, since you can set them yourself, your fstab becomes more readable and you can simply do it all wihtout any copy/paste or taking notes as one can remember a label like “system” or “backup” easily, compared to those UUID's.

so all you do is creat a partition and then assign a label to it.

for ext file systems that can be done with e2label:

e2label /dev/sda1 backups

will create a label “backups” for your /dev/sda1 partition

now you can use it in fstab like so:

LABEL=backups	 /backups ext4 defaults 0 0

it's as easy as that :)

  • harddisks_by_label.txt
  • Last modified: 06.01.2015 19:47
  • by Pascal Suter