Mounting an external USB drive to the Raspberry Pi

Mounting An USB Drive To The Raspberry Pii
Published: by
Last updated:

The Raspberry Pi’s operating system runs from a limited size, permanently inserted microSD card. This post will show how to mount a movable external USB drive for additional space, or purely for transportation purposes.


Fully workable Raspberry Pi with Raspbian installed and connected to the internet. Without a keyboard and screen, the process can also be done through PuTTY.

Step 1 Check the hardware

External USB drives can be in the form of a USB stick drive or USB storage drive. With regards to additional power requirements, USB memory sticks should be fine, but most external HDDs will require either their own power supply or a USB hub to run in a stable manner.

The Raspberry Pi should be switched on after the external drive is plugged in.

To check if the USB drive is attached correctly use the blkid command:


Mounting An USB Drive To The Raspberry Pii

The USB drive should show up somewhere. In this example, a USB stick drive is used for demonstration. blkid shows that a drive with the LABEL="DISK_IMG", TYPE="vfat"UUID="01F7-01E5" and a boot partition name of /dev/sda1 is connected.

The TYPE field shows the file system type and the boot partition name will be the USB drive’s mounting directory.

If TYPE is NTFS, ntfs-3g needs to be installed:

sudo apt-get install ntfs-3g

Step 2 Creating the local mount point directory

Although any directory can be used, the root /mnt directory is assumed to be used for mounting purposes. Assuming the mount directory will be /mnt/usb, it can be created by using:

mkdir /mnt/usb

Note that the Linux directory structure is case-sensitive. To make it fully accessible to all users, use:

sudo chmod -R 777 /mnt/usb
sudo chown pi:pi /mnt/usb

This will be the local mount point directory.

Step 3 Run the mount command

With the USB drive’s mounting directory and the local mount point directory known and prepared, the external USB drive can be mounted with:

sudo mount /dev/sda1 /mnt/usb

To test whether mounting took place correctly, use:


Mounting An USB Drive To The Raspberry Pii

From this, it is visible that the /mnt/usb directory is mounted to the /dev/sda1 directory.

Step 4 Automounting the USB drive on boot

The USB drive can either be mounted/unmounted manually every time it is required or it can be mounted automatically at each boot.

To mount the USB drive automatically every time at each boot, the mounting command can be added to fstab:

sudo nano /etc/fstab

Ignore the existing content of the fstab file. All that is needed is to add the new mounting entry at the bottom of the file.

# <name>        <dir>       <type>    <options>      <dump> <pass>
/dev/sda1       /           ext4      defaults       1      1
/dev/hdxx       /usr        ext4      defaults       1      1
/dev/sda5       swap        swap      defaults       0      0

Looking at the example fstab file above, the columns are as follows:

  1. <name> is the device name or other means of locating the partition or data source. The UUID or boot partition name can be used.
  2. <dir> is where the data is to be attached to the file system (the local mount point directory).
  3. <type> is the file system type or the algorithm used to interpret the file system.
  4. <options>, including if the file system should be mounted at boot. In this case it will be defaults.
  5. <dump> is the dump frequency that adjusts the archiving schedule for the partition (used by dump). In this case, it will be 0.
  6. <number> is the pass number, which controls the order in which fsck checks the device/partition for errors at boot time. The root device should be 1. Other partitions (including external drives) should be either 2 (to check after root) or 0 (to disable checking for that partition altogether).

For this example add the following line to the bottom:

# <name>      <dir>     <type>  <options>   <dump> <pass>
/dev/sda1/    /mnt/usb  vfat    defaults    0      0

Ctrl x & y to save out.

More about the fstab file can be read on the Debian wiki.

Step 5 Unmounting the USB drive

To unmount the USB again, use:

sudo umount /mnt/usb
About the author
Renier busies himself with improving his English writing, creative web design and his websites, photoshopping, micro-electronics, multiple genres of music, superhero movies and badass series.
Behind the Scenes is a free, informative website. If you find value in any of our content, please consider making a donation to our cause, or becoming a Patron for exclusive content.
Donate via PayPal Become a Patron

Save, share & discuss

Your comment is important, but don't be a knob. Keep it constructive and polite.

Leave a Reply

Your email address will not be published.

More Raspbian related posts