0

I know how to map /etc/fstab to the mount point with the device name:

/dev/sdb1        /mnt/home2      ext4    usrjquota=quota.user,jqfmt=vfsv0        0       0

This practice is however highly flawed as it is randomized and can change on reboots, especially when adding and removing disks. Instead, use UUID:

UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx       /mnt/home2      ext4    usrjquota=quota.user,jqfmt=vfsv0        0       0

The problem is that I need /dev/sda1 to remain /dev/sda1 and /dev/sdb1 to remain /dev/sdb1 (...etc with many drives) throughout reboots and changing and removing of disks.

Therefore, how can I retain BOTH the device name such as /dev/sda1 AND the mount point such as /mnt/home2 which will never be lost when adding, removing disks or on reboots?

Can both be added via fstab? If not, how to do it?

  • "The problem is that I need /dev/sda1 to remain /dev/sda1" Why? Non-persistent devices do not have consistency across adding hardware and bus rescans. – John Mahowald Mar 27 '20 at 13:15
  • Because I want to, there are reasons but my request is reason enough. –  Mar 27 '20 at 23:10

1 Answers1

0

Or, label file systems and mount those volumes by LABEL=. Does not uniquely identify an instance of a file system, only its name. Which may be a desired feature, if UUID is not known.


Consider LVM for logical volume names independent of any hardware path, LUN ID, or file system ID.

On Linux, you can create file systems on and mount logical volumes with their /dev/vg/lv devices. The advantage over UUID is that the file system can be reformatted or ID changed, but the same LV remains.

John Mahowald
  • 30,009
  • 1
  • 17
  • 32
  • I meant to use it using the existing filesystem, not to create LVMs. –  Mar 27 '20 at 23:10
  • Then use a file system UUID or LABEL (I forgot label). /dev/sdb1 is a non-persistent device name, Red Hat calls it such in their documentation. – John Mahowald Mar 27 '20 at 23:41
  • You literally completely ignored my question. The question was how to KEEP sda1, sdb1, etc –  Apr 13 '20 at 21:02
  • I do not have a solution that keeps the non-persistent block device names from moving around on hardware changes. – John Mahowald Apr 14 '20 at 00:15