Auto Mounting External USB drives

Matt Graham mhgraham at crow202.org
Wed Sep 9 15:52:44 MST 2020


> AZ Pete via PLUG-discuss wrote:
>> However, currently I have to manually mount each of the external
>> drives. This isn't a terribly big issue since the drives are
>> rotated to offsite storage only once per month. But, if the Pi
>> gets rebooted, the drives are not being auto-mounted and the
>> backups will then fail.

Backup script should check whether the disks are mounted or not?  But 
read on.

>> /etc/fstab to auto-mount them at boot, but if they drives are
>> not connected at boot time, I've found the the Pi doesn't boot
>> (it just seems to hang). 

If a thing may not be there, it is not recommended to auto-mount it on 
boot.

>> mount -t ntfs PARTUUID=c6040663-9321-4d28-91f0-2f3eb35f72b7 
>> /mnt/Ext3TB_Data1/

I thought you had to use NTFS-3g to write to NTFS.  Also, don't these 
things have labels?  It's much more readable and simpler to mount a 
thing with a label than a UUID if you can.

>> How can I "conditionally" mount an external drive based on if
>> the drive is currently connected?
On 2020-09-09 14:13, James Mcphee via PLUG-discuss wrote:
> autofs or udev rules would be your best bet.

https://wiki.archlinux.org/index.php/Udev#Mounting_drives_in_rules 
explains how to do this sort of thing using udev and systemd (yeck!).  
udev is not really meant for starting a long-running process, so there 
is a workaround.

-- 
Crow202 Blog: http://crow202.org/wordpress
There is no Darkness in Eternity
But only Light too dim for us to see.


More information about the PLUG-discuss mailing list