Detect and mount external usb drive - Linux (Debian)

I have a 3TB USB 3.0 External HDD (Seagate) that I would like my Debian machine to pick up on boot so that I can use rsync to backup to it using cron.

If i unplug the drive and plug it back in then it shows up when I do:

/dev/disk/by-uuid -lah

Then I can mount it (the UUID is in fstab already) by doing:

sudo mount -a

Unfortunately when I reboot the drive is not detected. This is a headless Linux box.

The drive is NTFS formatted.

Help would be appreciated!

Thanks,


Solution 1:

Mounting external hard drive on boot can be very tricky, troublesome operation. First, it adds delay to the boot sequence, then the drive has to be recognized and mounted. Imagine, if for some reason, the OS can't find the drive. It will get stuck at its boot sequence, waiting for the user to tell it to continue or not. You don't want this to happen.

What you need is autofs. Just apt-get install autofs and configure automounts -> create an entry for this drive in /etc/auto.master.

Example: /mnt /etc/auto.mnt --timeout=120 --ghost; Then in /etc/auto.mnt put: ``backup -fstype=ntfs,rw UUID=