Detect and mount external usb drive - Linux (Debian)

11

2

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,

Omar Mir

Posted 2012-08-06T22:24:40.523

Reputation: 213

1Is it the /dev/disk/by-uuid/ link that is not present, or the actual device? – Paul – 2012-08-07T05:34:59.993

The actual device. If I unplug the USB and plug it back in then the device shows up. – Omar Mir – 2012-08-07T16:10:24.723

After rebooting does the device show up when you run lsusb? This is before the /dev shows up but while the device is plugged in – Mark McDonald – 2012-08-10T00:19:33.627

It could be power stabilization time. 3TB USB 3.0 HDD is huge. It might not be ready by when udevadm runs. What do you see in your kernel log file when you plug it in? What do you see when you cold-boot with the HDD pluged in? Does anything change if you hot reboot? – Yasushi Shoji – 2012-08-14T15:51:02.990

Have you tried simply using gvfs? That should pick it up ok. – terdon – 2012-08-16T14:41:57.720

lsusb has no effect @i.. - I have tried that as per a few suggestions in my research. – Omar Mir – 2012-08-17T01:45:43.940

@YasushiShoji I'll try that, I normally don't have a screen attached to the system. – Omar Mir – 2012-08-17T01:46:23.223

@terdon not sure I can use gvfs on a headless, gnome-less box. – Omar Mir – 2012-08-17T01:46:42.240

@OmarMir, you do not have to have a screen attached. Check the files under /var/log/. – Yasushi Shoji – 2012-08-17T03:46:06.320

@YasushiShoji I'll try that soon and get back to you :) – Omar Mir – 2012-08-20T00:38:44.390

What does this mount's /etc/fstab entry look like? What did your look at the log files tell you? – zero2cx – 2012-09-20T17:46:52.427

Answers

3

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=

grs

Posted 2012-08-06T22:24:40.523

Reputation: 1 092