Ubuntu – How to automount usb drive reliably without fstab


I need a way to mount a usb drive without using fstab.

I Cannot use fstab because the drive is not connected to my computer at boot. This causes an issue during any one off reboots because start up hang waiting for this device until a keyboard intervention to skip it.

I cannot use my current script with just does mount /dev/sde1 /media/Backup because sometimes it changes to sdf.

Consider this a server install. I can't use tools at the user or GUI level.

I suppose the sum of my question is how to manually mount a USB drive from the commandline considering the reliability of the /dev/sd value isn't consistent.

Best Answer

  • You should get the UUID of the drive (e.g $ blkid /dev/sde1), then mount with /dev/disk/by-uuid/ instead of the normal method (e.g $ mount /dev/disk/by-uuid/[UUID] /media/drive). The UUID is intrinsic to the disk, so it should work regardless of the device used to mount it.

  • Related Question