I was recently looking at storage expansion options on my Raspberry Pi (UK). This choice is limited — USB ports are often used by keyboards, mice, or retro game controllers. while the SD card slot is naturally limited to just one device.

In terms of expanding storage via USB devices, there are two options, but how you connect them will affect your success. For example, you can plug a USB hard drive or flash drive into one of the USB ports, but if another device needs that port, things can get tricky.

Many Raspberry Pi owners use powered USB hubs to get around this problem, and once you realize the importance of this (the computer doesn’t draw enough power to handle most USB devices), add a new USB storage device. otherwise, it shouldn’t be a problem.

However, there are a few things to consider when expanding storage on your Raspberry Pi. While there are really only two common USB drives (flash drive and hard drive), you should also look out for a very useful map extension trick for Raspbian. operating system.

Three main storage options

You will find that you have three main options for adding, storing, and deleting data on your Raspberry Pi:

  • SD/SDHC card
  • flash drive
  • USB hard drive

You can also use network drives, USB DVD-R drives, and NAS devices. NAS devices (probably based on a Raspberry Pi!) For additional storage, but the ones listed above should be considered the top three options.

We will look at the three options in more detail, how they can be used most effectively, and any downsides or disadvantages.

Using an SD card to store Raspberry Pi data

As you probably know if you’re using a Raspberry Pi, the SD card is the main storage option. The Pi uses this card — which should be an SDHC card for best results — as a boot device, to run the operating system, and share storage. It effectively replaces the role of a hard drive in standard desktop computers, although it can be considered more similar to an SSD. in terms of no moving parts and low energy.


There are various operating systems for Raspberry Pi. Probably the most popular is Raspbian. which is designed to run on a 2 GB SD card by default. The result of this is that when flashing a Raspbian image, all SD cards will have a 2 GB partition, leaving a large chunk of SD card memory unused.

Fortunately, there is a way around this. Function file system extensions included in Raspbian’s raspi-config screen and allows you to increase the size of a partition up to the maximum capacity of your SD card. See 4 Tweaks to Supercharge your Raspberry Pi on how to do this.

Connecting and Installing a USB Drive

Inserting a USB flash drive will not have the same effect as in an OS like Ubuntu or Windows. Instead, you will need to manually mount the device in order to use it as an additional USB drive for your Raspberry Pi.

sudo ls /dev/sd*


This will show the correct name for the USB device (sda1 or sda2). You should then type in the following, trying to replace [USB_DEVICE_NUMBER] to the device name, as found above.

sudo mount -t vfat /dev/[USB_DEVICE_NUMBER]/mnt/usb

Your USB stick will then be mounted as a device accessible from the file browser on your Raspberry Pi!

What about USB HDD?

Especially useful if you use Raspberry Pi as the main component of your media center or in the form of a NAS storage, connecting a hard drive will significantly increase the amount of memory.


Also, pay attention to using powered USB hubs as mentioned above. If your USB hard drive doesn’t have a power source (unlikely, but they do exist), you should use a powered USB hub. Otherwise, use a hard drive with its own power supply.

You may now run into issues when connecting a USB hard drive to your Raspberry Pi. In an ideal situation, this could be a plug and play case, and if you have the most up-to-date Pi, you should be able to access your hard drive with a mini computer without any problems — the device should mount automatically. and everything will just work.

However, without proper disk configuration and file system, you will find that the disk performs poorly. For example, you can use an NTFS drive with a driver added, but transferring data using this method is slow. To use your USB hard drive effectively (and exclusively on your Raspberry Pi), the EXT 4 file system must be used — so if you already have any data on the hard drive, you need to back it up first before back-up formatting.

Raspberry Pi USB Hard Drive Setup

Is your USB external hard drive empty? If so, you must format it to EXT4, which you can do in Raspbian:

sudo mkfs.ext4 /dev/sda1 -L untitled

If you need to mount the drive first (you might have an EXT4 partition, for example), use the following:

sudo mkdir /mnt/usbdrive

This creates a directory for the device, which is mounted with this command:

sudo mount /dev/sda1 /mnt/usbdrive

You can use the following command to view the contents of a mapped drive:

ls /mnt/usbdrive

Finally, if you plan to eject the drive while the Raspberry Pi is on:

sudo umount /dev/sda1

As a side note, if you don’t want to reformat your hard drive with the EXT4 file system, you can still use NTFS with a performance hit. You’ll need a disk to do this, so open a terminal and type:

sudo apt-get install ntfs-3g

This will install a driver that will allow you to use an NTFS hard drive with your Raspberry Pi.

Easy to install — if you make the right choice

With two extended storage options for USB (plus the bonus of Raspbian’s SD card expansion), the Raspberry Pi can access the same amount of external space as a desktop computer.


While being able to use a USB flash drive is useful, you’ll probably get the best storage and fastest results using an EXT4-formatted USB external hard drive. However, it must be a dedicated drive as EXT4 is not compatible with other operating systems. If this is impractical, use an NTFS formatted hard drive with the ntfs-3g driver.

Additional storage provides benefits in most Raspberry Pi projects, from a RaspBMC media center to installing a NAS box. Please note that we have discussed this for the Raspbian OS and related builds — other (less popular) Raspberry Pi operating systems may have different commands and drivers for managing storage.

Image Credits: vector raspberry, flash drive via Shutterstock

Похожие записи