Force USB mounts on boot

I have a dual-SSD rig that has started unmounting the drives on reboot.
How can I force each drive to mount on boot and stick to their assignment ie. sda1?

I’ll answer the second part of your question first. You cannot. This is exactly the reason why UUID and LABEL support was added to mount, because due to electrical glitches, the enumeration of storage devices can change between reboots ─ /dev/sda can become /dev/sdb and vice versa.

As for the first part of your question, that’s what /etc/fstab is for. See the following man pages… :arrow_down:

man mount
man fstab

If you need any more information, then you’re also going to have to provide us with more information yourself. We have no idea what your setup is, what filesystems are involved, which mountpoints, and so on. :man_shrugging:

I ran lsblk --fs and have the UUIDs of the 2 SSDs:

sda1 needs to mount to /mnt/usb
sdb1 needs to mount to /mnt/backup

so I edit /etc/fstab to this?

UUID=UUID_OF_SDA1 /mnt/usb ext4 defaults
UUID=UUID_OF_SDB1 /mnt/backup ext4 defaults

1 Like

Almost. :wink:

Add 0 0 to the end of each line. I would also add the nofail option if these are removable drives, or else your system will refuse to boot if they’re not attached.

UUID=UUID_OF_SDA1    /mnt/usb       ext4    defaults,nofail    0   0
UUID=UUID_OF_SDB1    /mnt/backup    ext4    defaults,nofail    0   0
1 Like

Thanks. They are Internal SSD that are storing data - boot partition is on eMMC.

1 Like

Looks like setting drives to specific /sd_ is possible with udev rules.

The program I am using relies on sda1 as main drive & sdb1 as backup.

https://wiki.archlinux.org/index.php/Persistent_block_device_naming

Added the lines to /etc/fstab but the drives didn’t mount on boot.

Maybe add auto to the mount options? But strictly speaking, that should not be necessary, as the defaults value for hard disk partitions normally already includes the auto option.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.