Conditionaly mount an external drive using /etc/fstab

###Special thanks to @daveb for initially helping me with fstab!
I have a multiple boot system and share an external drive [ntfs] with Windows 7 and 2 Ubuntu installs. I don’t always need the external drive therefore I don’t always power it on, but I want it available when it’s turned on without extra steps.

Here’s my entry in /etc/fstab that enables this. You’ll need to determine your own UUID with code lsblk -f returns UUIDs of your connected devices.

UUID=1C738CA75C9095B8 /media/ext_data ntfs nofail,x-systemd.device-timeout=3,uid=1000,gid=1000,dmask=027,fmask=137,windows_names 0 2
#####section explanations
UUID=1C738CA75C9095B8 = the UUID of the drive in question
/media/ext_data = the mount point
ntfs = file system type
nofail = ignore drive if not present
x-systemd.device-timeout=3 section add 3 seconds to boot when the device is powered off
uuid=1000 = my userid uuid
gid=1000 = group id
dmask=027,fmask=137,windows_names 0 2 suggested for windows accessible drives

Full explanation of different option available here.

5 Likes