Raspberry Pi 2, Auto-Mounting USB


  1. Installing Raspbian
  2. Auto-Mounting USB Drives
  3. Transmission
  4. SickBeard
  5. CouchPotato
  6. MiniDLNA
  7. Samba

Identify the drive, in this case it's /dev/sda1 with a UUID of E033-1109 and type FAT:

sudo blkid

# /dev/sda1: LABEL="ELEMENTS" UUID="E033-1109" TYPE="vfat"

Create a dir it will be mounted at:

sudo mkdir /mnt/usbel  

Own it:

sudo chown -R pi:pi /mnt/usbel  

You could manually mount it

sudo mount -o uid=pi -o gid=pi -t vfat /dev/sda1 /mnt/usbel  

But let's auto-mount it instead:

sudo vim /etc/fstab  

Add add the following line to the bottom, it should all be on one line:

UUID=E033-1109 /mnt/usbel vfat auto,users,rw,uid=1000,gid=100,umask=0002 0 0  

We're mounting the drive by its UUID to ensure we always get the correct drive. We're setting rw to allow read-write permissions, uid=1000 sets the user to "pi" (see the id command), gid=100 sets the group to "users" (again, see the id command) and umask=0002 sets rwxrwxr-x permissions on the mount.

For more details on the possible permissions, see What is umask and fstab permissions explained.

We can reapply our mounts with sudo mount -a before we sudo reboot.

I had issues where this just wouldn't mount on reboot. I'd have to sudo mount -a manually. I found a few different threads where Raspberry Pi 2 users were encountering the same issues, which seems to be caused by a bug in Linux/Debian. A permanent fix will apparently be in Debian's "Jessie" release, but until then adding a delay works to give the USB drive to initialise:

sudo vi /mount/cmdline.txt  

Add to the end (others report 5 works, but I needed to up it to 10):

rootdelay=10  
Last updated on