2

When first tinkering around with my Raspberry Pi 2 I just booted from the SD card and got my USB drive, which I'm using to host GIT repositories, to automatically mount on startup.

In order to get more space I'm now using an external HDD as root filesystem. Since I managed to get things running correctly I'm unable to automount my USB drive on startup altough it's listed in my /etc/fstab:

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p5  /boot           vfat    defaults          0       2
#/dev/mmcblk0p6  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, so no using swapon|off from here on, use  dphys-swapfile swap[on|off]  for that
#!!! next line is the HDD raspbian is running on !!!
/dev/disk/by-uuid/f9922113-a0fc-44b9-b3bb-7c2f7da670c4  /   ext4    defaults,noatime  0       1
/dev/sda1  /mnt/usbdrive   auto    uid=pi,gid=pi,umask=0022,sync,auto,nosuid,rw,nouser 0 0

I also tried to mount it by label and UUID (like my HDD) but to no avail. Is there some kind of "mounting order" to consider since my HDD is /dev/sdb1 and by USB drive /dev/sda1?

Update

Regarding the UUID I forgot to mention something strange. I basically got the UUID by using blkid resulting in

/dev/sda1: LABEL="GIT" UUID="3a20b6ab-f7cb-44a4-9437-23b8ba33fef2" TYPE="ext4"

When I take a look at the UUIDs in /dev/disk/by-uuid I get the following

lrwxrwxrwx 1 root root 10 Jan  1  1970 66a72c4f-1a9b-47ad-99b7-3040ab1f79f6 -> ../../sda1

Of course I tried both UUIDs for automount but expectably neither worked. Maybe this discrepancy is the root cause.

Update 2

Thanks to the guys over at Unix & Linux StackExchange blkid and /dev/disk/by-uuid now are in sync again. Unfortunately this hasn't fixed my automount problem. Any further ideas what the cause might be?

  • There's no guaranteed mounting order, although if it always works out the same way, then you could just go with whatever that is. I'd double check the UUID thing. How did you get it from the stick? Beware there might be one for the device, but you want the one for the filesystem. – goldilocks Aug 14 '15 at 13:40
  • You might consider asking a generic question on Unix & Linux along the lines of "Why blkid would be different than by-uuid?". Just make it very clear this does not involve RAID, since there's a pile of questions there already about that (saying you are aware of this would not be a bad thing). – goldilocks Aug 14 '15 at 15:37
2

Could it be that you forgot to tell the system what file-system is used?

try changing

/dev/sda1  /mnt/usbdrive   auto    uid=pi,gid=pi,umask=0022,sync,auto,nosuid,rw,nouser 0 0

to

/dev/sda1   /mnt/usbdrive   <ntfs-3g/ext4/ext3/.... take a pick here>  auto    uid=pi,gid=pi,umask=0022,sync,auto,nosuid,rw,nouser 0 0
  • Nope, unfortunately still no automounting. – Kagemusha Aug 14 '15 at 13:06
0

As explain on the Official Raspberry website HOWTO: Move the filesystem to a USB stick/Drive

NOTE 1
To be on the safe side, there is one more command we should add to that single line.
During the power-up/boot sequence, it may take the USB drive a little longer to spin up to speed and be ready, than the OS expects.
The default waiting period seems to be 2 seconds for USB devices. If we add a delay of 5 seconds to the /boot/cmdline.txt (rootdelay=5), the USB drive should be ready when it's needed. If not, use an even longer period. When you use a stick or SSD drive this will most likely not be needed.

[update] The more up-to-date method now seems go towards adding this code to the /boot/config.txt file.


Code:

sudo nano /boot/config.txt

and add

program_usb_timeout=1

I'm not sure how much longer the rootdelay option for cmdline.txt will be usable in the future.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.