Why is my USB drive not mounted during startup

3

I have Arch Linux running on my Raspberry Pi. I added the following line to my fstab file:

/dev/sda1    /mnt/MyBook    ntfs    defaults    0    0

for a while this worked fine, the device was mounted automatically at startup. I installed transmission-cli and was downloading some stuff when the Pi seemed to die. I turned it off and on again and noticed the drive wasn't mounted. If I run sudo mount -a the drive will be mounted again just fine, but why is it not doing this at startup anymore?

DaveJohnston

Posted 2012-06-21T22:32:27.570

Reputation: 245

Just to add to my question, this used to work just fine every time I started up but just stopped all of a sudden. Also I can always run mount -a and mount it manually after startup, so there is no error in my fstab file. – DaveJohnston – 2012-06-22T09:25:23.433

I spent ages trying to figure this out last night, this morning I ssh'd into my Pi from work and restarted it, and it mounted during boot. – DaveJohnston – 2012-06-22T09:29:19.670

Answers

2

One possible explanation is the 'defaults' option was changed to use 'noauto' for your ntfs partition. (Is there a tunefs for ntfs?)

Another (more likely) explanation is with boot order and boot timing: the module for the USB stack may perhaps be loaded after the fstab boot-time mounts are attempted; or the USB device doesn't respond fast enough for the kernel, so boot proceeds before it's ready.

There's no resolution in this linked discussion, but see: https://bbs.archlinux.org/viewtopic.php?id=79676 - moving the mount to rc.local may help you. (As well as specifying a delay in rc.local.) Considering the RasPi isn't the fastest ship in the pond I'd lean towards this being a timing issue.

cydonian.monk

Posted 2012-06-21T22:32:27.570

Reputation: 151

Two questions: any particular reason why it would just start doing it when it worked fine before? And is there some log file that I can look at that might show this? – DaveJohnston – 2012-06-22T09:18:34.987

Have you made any kernel updates recently? Did Transmission's install make any changes? Require any new modules? You can check pacman's log in /var/log/pacman.log but I'm not sure how much help it'll be. – cydonian.monk – 2012-06-22T15:21:58.737

It installed libevent (2.0.19-1) with it. – DaveJohnston – 2012-06-23T11:24:15.793

0

You could also try changing defaults to "auto, defaults" in fstab:

/dev/sda1    /mnt/MyBook    ntfs    auto,defaults    0    0

terdon

Posted 2012-06-21T22:32:27.570

Reputation: 45 216

0

USB disk is not ready to mount during system start-up so you can't mount it using fstab.

Try to do it using e.g cron after reboot. It works fine. My usb disk has a label "usbhdd", so check label of your disk and change name after grep in my example.

First, write a script (file name: mountusbhdd) in /usr/local/bin:

echo mounting usb disk:
while ! df | grep usbhdd; do
   echo "10 sec break..."; sleep 10
   sudo mount -t ntfs-3g -o uid=pi,gid=pi,umask=000 /dev/sda1 /media/usbhdd
done
echo "usbhdd mounted."

Add "x" permission:

sudo chmod +x /usr/local/bin/mountusbhdd

and add this script to your crontab:

crontab -e

add line:

@reboot /usr/local/bin/mountusbhdd>/tmp/usbhdd.log

That's all, after reboot you can chceck /tmp/usbhdd.log how much time does your disk need to be mounted. My disk need 10 seconds delay.

Andrzej

Posted 2012-06-21T22:32:27.570

Reputation: 1