How to mount USB drive to Raspberry Pi

By | November 20, 2015

There are just a few simple steps to mount a USB drive to your Raspberry Pi.

Step 1:

The first command you want to run (with your usb plugged in) is:

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

This will output something like:

usb

the ../../sda1 is the name of the usb that I have plugged in.

Step 2:

Next you want to create a mount point with this command:

>> sudo mkdir /media/usbstick

Replace usbstick with whatever you want to name the directory.

Step 3:

You’ll then need to change the owner of the directory to pi otherwise you’ll run into trouble down the road.

>> sudo chown -R pi:pi /media/usbstick

Step 4:

The final step is to mount the drive via:

>> sudo mount /dev/sda1 /media/usbstick -o uid=pi,gid=pi

Note that there is no space after the comma. Then all you have to do next is to cd into the directory:

>> cd /media/usbstick
>> ls

mounting

To unmount so you can remove the usb stick, run:

>> sudo umount /media/usbstick

If you try and un-mount and get these messages:

>> umount: /media/usbstick is not in the fstab (and you are not root)
>> umount: /media/usbstick: device is busy. (In some cases useful info about processes that use the device is found by lsof(8) or fuser(1))

Then try adding sudo and make sure you are not in the /media/usbstick directory itself when you are trying to un-mount the drive.

umount

Leave a Reply

Your email address will not be published. Required fields are marked *