Auto Mount USB Drives in Raspbian

Update and upgrade the Raspbian installation.

1
sudo apt-get update && sudo apt-get upgrade

Install the package necessary to automatically mount USB drives.

1
sudo apt-get install usbmount

Now plug a USB drive and issue the df command to view all volumes. My USB drive was recognized /dev/sdb and mounted as /media/usb0 by the system.

1
2
3
4
5
6
7
8
9
10
11
12
df -hT

pi@raspberrypi ~ $ df -hT
Filesystem Type Size Used Avail Use% Mounted on
rootfs rootfs 2.9G 2.6G 215M 93% /
/dev/root ext4 2.9G 2.6G 215M 93% /
devtmpfs devtmpfs 460M 0 460M 0% /dev
tmpfs tmpfs 93M 256K 93M 1% /run
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs tmpfs 186M 0 186M 0% /run/shm
/dev/mmcblk0p1 vfat 56M 15M 42M 26% /boot
/dev/sdb1 vfat 2.0G 200M 1.8G 11% /media/usb0

To un-mount a volume make use of the df command above to discover the USB drive mount point and issue the unmount command as follows.

1
sudo umount /media/usb0