Linux - Advanced automounting via /etc/fstab file

4

1

I have a simple server with 6 hard disk drives (all SATA) inside of it. They are in a simple JBOD (just a bunch of disks) mode, so Linux just shows the following devices (assume each one has a single ext2 partition).

/dev/sda
/dev/sda1
/dev/sdb
/dev/sdb1
/dev/sdc
/dev/sdc1
/dev/sdd
/dev/sdd1
/dev/sde
/dev/sde1
/dev/sdf
/dev/sdf1

Now, if I were to swap two of the disks by accident during routine maintenance, the mappings between device name (ie: /dev/sdx) and the actual disk being name is swapped.

Is there a way to have fstab require additional arguments (ie: some sort of VOLUME/DISK UUID, or some kind of drive serial number) so that I can enforce a device-name-to-physical-device mapping that does not change if the drives are incorrectly wired inside the server?

Thank you.

Cloud

Posted 2012-07-04T17:39:59.197

Reputation: 521

Answers

5

Absolutely. If your partitions have a label (via e.g. e2label) then you can use LABEL=xxxx, otherwise you can use UUID=xxxx after getting the UUIDs with blkid.

Ignacio Vazquez-Abrams

Posted 2012-07-04T17:39:59.197

Reputation: 100 516

@Izzy Both answers were great, but this one showed me how to get the label/UUID as well. Thank you both (@Izzy & @Ignacio) – Cloud – 2012-07-05T13:11:08.700

4

Instead of /dev/sdX you can use UID= as in this example:

UUID=81658fcf-1777-457a-934e-5d9a399fdf26 /  ext4  errors=remount-ro   0   1

Then the order of devices should no longer matter.

Izzy

Posted 2012-07-04T17:39:59.197

Reputation: 3 187