Raspberry Pi Mount a USB Drive Tutorial

In this guide, we’re going to use a Raspberry Pi to mount a USB drive. We show you both how Raspbian automatically mounts a drive and how to do it manually.

Raspberry Pi Mount USB Drive

If you’re looking to have this drive accessible over your network, then the Raspberry Pi samba server is better suited for your needs.

It’s important to know that Raspbian lite currently does not automatically mount your drives. So you will need to either set it up manually or install the software package to have it automatically mount.

Mounting drives is an important skill to have when it comes to working hard drives and file structures in Linux. Once you have a general understanding, it becomes a pretty easy task.

Having a good understanding of Linux file permissions will make this tutorial a lot easier. If you don’t, then you should still be able to complete this tutorial without issue.


You will need some basic equipment for setting up a Raspberry Pi mounted USB drive.


Raspberry Pi

Micro SD Card if you’re using a Raspberry Pi 2, 3, or 4 (8 GB+ Recommended)

Ethernet Cord or Wifi dongle

External Hard drive or USB Drive


Raspberry Pi Cases

USB Keyboard

USB Mouse

Note: If you plan on using an external hard drive, then it is highly likely you will need a powered USB hub.  This recommendation is because the Raspberry Pi is unable to output enough power via the USB ports to power the drive.


If you want to see how to do this project visually, then be sure to check out my video below. It will take you through all the necessary steps to getting your USB drive mounted correctly.

If you do like the video, then be sure to subscribe or follow us on social media to stay up to date on all my projects, guides and much more.

Mount a USB Drive to the Raspberry Pi Automatically

In the latest version of Raspbian (Stretch), your USB drives should be automatically mounted when it is connected to the Pi.  It is important to know if you do upgrade to Stretch from Jessie there might be compatibility problems with older projects & tutorials.

If you want to check where your drive has been mounted, you can simply use the following command.

sudo cat /proc/mounts

This will output quite a bit of text. Any USB drives are typically at the bottom of the text as shown in the image below.

USB drive automatically mounted

As you can see my drive located at /dev/sda1 has been automatically mounted to /media/pi/CA1C-06BC.

The automatic mounting done by Raspbian will be fine for most projects and just regular use. It will retain its mount location whenever you remove and re-insert the drive since it uses the UUID of the drive for the mount folder name. You can also find out the UUID by using the following command: ls -l /dev/disk/by-uuid.

You might come across problems if you wish to allow access to the drive to a specific user that isn’t the default user. In our next step, we will mount the drive using the fstab file and force permissions of a given user and group.

Mount a USB Drive to the Raspberry Pi Manually

If you want to permanently mount the drive with a specific user, then we will need to set up the drive in the fstab file.

1. Firstly install the following package if you’re using an NTFS drive.

sudo apt-get install ntfs-3g

2. Now if you don’t know the drive UUID, then we will need to get it. You can get a list of drives and their UUID that is currently connected to the Pi by running the following command.

ls -l /dev/disk/by-uuid

3. Now there is likely to be quite a few drives listed. Simply look for any drive that has an address of /sda* where * is a number.  In my example, it is 1, so we will use the UUID of CA1C-06BC to mount to.

4. Now it is important that we create a clean directory to mount the USB too. To create the directory, enter the following:

sudo mkdir /media/usb1

5. Next, we will need to obtain both the uid and the gid. These numbers are important as we will need them to set the correct permissions for the USB drive. To get the gid enter the following command. If you’re using a different user than pi, then make sure you update the username in the following commands.

id -g pi

6. Get the uid enter the following command.

id -u pi

7. Next, we need to make an edit to the fstab file. It is the file that is called on boot up to set up the drives. To edit this file,  enter the following command:

sudo nano /etc/fstab

8. Now add the following line to the bottom of this file. Remember to update the line with all the relevant details for your USB drive. (For example, your drive will have a different UUID)

UUID=CA1C-06BC /media/usb1 auto nofail,uid=enter_uid_here,gid=enter_gid_here,noatime 0 0

fstab USB drive mount
9. Now since the Pi automatically mounts the drive, we will need to un-mount the drive. A simple way to do this is to use the following command (Replace /dev/sda1 with the address relevant to your Pi).

sudo umount /dev/sda1

10. Now you can use the following command, and your drives should become mounted.

sudo mount -a

11. If you want to make sure the drives are restored after the Pi has been shut down then simply run the following command:

sudo reboot

12. The drives should be automatically mounted after the Raspberry Pi has finished rebooting.

Hopefully, you have your drive mounted to the Raspberry Pi now. If you have any troubles, then be sure to check out the troubleshooting guide below.


These following issues will most likely arise only for when you manually mount the drive.

One of the biggest problems that you will come across with mounting a drive is permissions. If you’re finding that you can’t read or write files to the mounted drive, then it is likely that the drive is mounted as the wrong user or group.

Another problem you may come across is the drive not being mounted on boot. There have been some changes to Raspbian and the Raspberry Pi that might cause issues with mount the drive in time.

The best way to work around this would be to add the following lines before the exit 0 line in the /etc/rc.local file.

sleep 20
sudo mount -a

Hopefully, you are now able to set up a Raspberry Pi mount USB drive. If you are having issues with the mount, I missed something or anything else then feel free to drop a comment below.

We also have plenty of Raspberry Pi beginner projects that you should take a look at if you’re looking to do doing something cool with your Pi.


  1. firefly on

    Thank you very much. This solved my problem.

  2. Toby on

    Sorry if this is a stupid question but I want to make it so that my USB drive will automatically mount to the Pi when I hot plug it without rebooting the Pi, I am running the minimal Debian install, is there a way to do this.

    1. Toby on

      My drive isn’t automounted for some reason, I was hoping you could tell me how to change this to make it like the default

  3. Mainak Ghoshhajra on

    Thank you very much for the tutorial . But i have some . question .
    My requirement is to drive a tablet PC from raspberry pi through USB. It is not showing anything . I have tested the path using normal FAT32 flash drive .The flash drive is getting detected.
    Please let me know the way out.

Leave a Reply

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