Setting up an fstab that does not depend on the device name


If you install Omarine on an external USB hard drive, it will be assigned a device name that might be changed when there are other USB devices. Suppose your USB hard drive is /dev/sdc divided into two partitions, /dev/sdc1 for root partition and /dev/sdc2 for /home partition. The two corresponding entries in your /etc/fstab may look like this:

/dev/sdc1      /          ext4      defaults      1    1
/dev/sdc2 /home ext4 defaults 1 2

This filesystems table will not work if the device name has been changed in a booting time, such as changing to /dev/sdb.
One way is to change the first field of entries in the fstab to UUID=<uuid> form.
You can run the grub-probe command to find their uuids as follows, as the root user:

grub-probe --target=fs_uuid --device /dev/sdc1
grub-probe --target=fs_uuid --device /dev/sdc2

As a result, your fstab will need to change as follows:

UUID=8434896e-9ffe-4869-982e-dc80296d6ea4      /          ext4      defaults      1    1
UUID=15ce184e-950e-45a5-92f8-bf35796c0a28 /home ext4 defaults 1 2

In case you booted the system on that USB hard drive, then exactly /dev/sdc1 was mounted on / and /dev/sdc2 was mounted on /home. You can run the grub-probe command simply, as the root user:

grub-probe --target=fs_uuid /
grub-probe --target=fs_uuid /home

Currently unrated


There are currently no comments

New Comment


required (not published)



What is 6 + 3?