How to Mount a USB Drive on Raspberry Pi (Jessie)

I followed this guide.

Create the mount point:

sudo mkdir usbdrive

Make pi the owner of the mounted drive and make its permissions read, write and execute for it

sudo chown -R pi:pi /media/usbdrive
sudo chmod -R 775 /media/usbdrive

Set all future permissions for the mount point to pi user and group (explanation can be found here)

sudo setfacl -Rdm g:pi:rwx /media/usbdrive
sudo setfacl -Rm g:pi:rwx /media/usbdrive

sudo blkid

You will see something like this. Again it is the sda1 line we are interested in. Note the TYPE=”exfat” at the end, you will need this for the fstab file. It is easiest to copy it now and paste it after running nano in the next step.
Look for the sda1 line.

For all drive types mount the usb with this command, -o insures pi is the owner which should avoid permission issues

sudo mount -t uid=pi,gid=pi /dev/sda1 /media/usbdrive

sudo ls -l /dev/disk/by-uuid/

This will display the UUID – the very unique ID for the drive itself, so you can be explicit in which USB drive you’re mounting. Use this UUID to add a line to /etc/fstab

sudo nano /etc/fstab

Add a line like:

UUID=5027202e-d084-4569-8bea-d425d71d8de6 /media/usbdrive ext4 nofail,defaults 0 0

 

 

Advertisements