Mounting USB thumb with Raspberry Pi

Identify the drive,

sudo blkid

Ex:

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

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

 

Create a directory it will be mounted at:

sudo mkdir /mnt/usbel  

Own it:

sudo chown -R pi:pi /mnt/usbel 

 

  1. If you drive is in FAT32

You could manually mount it:

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

But let’s auto-mount it instead:

sudo nano /etc/fstab 

add the line to the end of the file (you can copy and paste this line)

/dev/sda1        /home/pi/usbdrv       vfat    uid=pi,gid=pi,umask=0022,sync,auto,nosuid,rw,nouser 0   0

  1. If your drive is NTFS

Install ntfs-3g

sudo apt-get install ntfs-3g

You could manually mount it:

sudo mount -o uid=pi -o gid=pi -t ntfs-3g /dev/sda1 /mnt/usbdata  

you can auto mount if:

sudo nano /etc/fstab

Then insert this line below

/dev/sda1        /home/pi/usbdrv       ntfs-3g    uid=pi,gid=pi,umask=0022,sync,auto,nosuid,rw,nouser 0   0

Important: this is 1 line, not broken up over two lines  (the Instructable is doing weird things to the formatting).

CTR + X, then Y, then Enter/Return to save your change.

What this does is to map the /dev/sda1 deviceany thumb USB drive to the usbdrv directory.

Then restart.

sudo reboot

In case you want to unmout:

sudo umount /dev/sda1