You can add storage to a Raspberry Pi by connecting a USB drive or external hard drive directly to one of its USB ports
A Raspberry Pi has limited built-in storage — typically 32GB to 128GB depending on your model — which fills up quickly if you're running applications, storing media, or collecting data. The simplest solution is to plug a USB external drive into one of the Pi's USB ports. The drive will appear as a folder you can read from and write to, just like a folder on the Pi's main storage.
The process takes about 10 minutes and requires no soldering or special tools. You'll need the external drive itself, a USB cable if it doesn't have one built in, and a way to open a terminal window on your Pi — either by connecting a keyboard and monitor, or by using SSH (a remote connection method) if your Pi is already set up on your network.
Key Takeaways
- Most USB drives and external hard drives work with Raspberry Pi without any special software, but you may need to format the drive first if it's brand new.
- You identify your drive using the terminal command lsblk, which shows all connected storage devices and their names.
- The drive must be mounted — connected to the file system — before you can use it, which you do with the mount command or through the desktop file manager.
- If you want the drive to mount automatically every time the Pi starts, you need to add one line to a configuration file called fstab.
- External hard drives that need their own power adapter work better than bus-powered drives for long-term use, because the Pi's USB ports have limited power.
Plug in the drive and identify it in the terminal
Connect your USB drive or external hard drive to any USB port on the Raspberry Pi. If you're using a desktop with a monitor and keyboard, open a terminal window. If you're connecting remotely via SSH, log in to your Pi first.
Type lsblk and press Enter. This command lists all storage devices connected to your Pi. You'll see your main storage (usually called mmcblk0 for the SD card) and your new external drive (usually called sda, sdb, or similar). Note the exact name — you'll need it in the next step.
If the drive doesn't appear, unplug it, wait 10 seconds, and plug it back in. Then run lsblk again. If it still doesn't show up, the drive may be failing or the USB port may not be working.
Format the drive if it's new or unreadable
If your drive is brand new or was previously used with a different system, you may need to format it first. Formatting erases everything on the drive and prepares it to work with your Pi. Skip this step if the drive already contains files you want to keep.
To format the drive, type sudo mkfs.ext4 /dev/sda1 (replace sda1 with your drive's actual name from the lsblk output). Press Enter and type your password when prompted. The process takes a few seconds to a few minutes depending on the drive's size. Do not unplug the drive while this is happening.
If you see an error saying the drive is already mounted, run sudo umount /dev/sda1 first, then try the format command again.
Create a folder where the drive will appear
Before you can use the drive, you need to create an empty folder — called a mount point — where the drive's contents will show up. This folder can be anywhere, but the easiest location is in your home directory.
Type mkdir ~/external_drive and press Enter. This creates a folder called external_drive in your home directory. You can name it anything you want — backup, media, or storage all work fine.
Mount the drive so you can use it
Now connect the drive to the folder you just created. Type sudo mount /dev/sda1 ~/external_drive (replace sda1 with your drive's actual name). Press Enter and type your password.
The drive is now mounted. You can navigate to the external_drive folder and see its contents. If you're using the desktop, open the file manager and look for the folder in your home directory. If you're in the terminal, type ls ~/external_drive to list what's on the drive.
To unmount the drive later — for example, before unplugging it — type sudo umount ~/external_drive. Always unmount before physically removing the drive to avoid corrupting files.
Set the drive to mount automatically on startup
If you want the drive to mount every time your Pi starts, you need to edit a file called fstab. This saves you from typing the mount command manually each time.
First, find your drive's UUID (a unique identifier). Type sudo blkid and look for your drive in the output. Copy the UUID value — it looks like a long string of numbers and letters. Then type sudo nano /etc/fstab to open the configuration file.
Scroll to the bottom of the file and add this line: UUID=your-uuid-here /home/pi/external_drive ext4 defaults,auto,user,rw,nofail 0 0 (replace your-uuid-here with the actual UUID you copied, and replace /home/pi/external_drive if your username or folder name is different). Press Ctrl+X, then Y, then Enter to save and close the file.
Restart your Pi by typing sudo reboot. When it comes back online, the drive will be mounted automatically.
Troubleshooting common problems
If you get a "permission denied" error when trying to write files to the drive, the folder permissions may be wrong. Type sudo chown -R pi:pi ~/external_drive to give your user account ownership of the folder. Replace pi with your actual username if it's different.
If the drive keeps disconnecting, it may not be getting enough power. USB drives usually draw power from the Pi's USB port, but large external hard drives need their own power adapter. If your drive has a power cable, plug it in. If it doesn't and keeps disconnecting, consider upgrading to a powered external hard drive or using a powered USB hub.
If you see "input/output error" messages, the drive may be failing. Try the drive on a different computer to test it. If it fails there too, the drive is likely damaged and should be replaced.
Frequently Asked Questions
Do I need to format the drive before using it?
Only if it's brand new or was formatted for a different operating system. If the drive already has files on it and you can see them after mounting, you don't need to format. Formatting erases everything, so only do it if you're sure you don't need the existing files.
What's the difference between ext4 and other file formats?
ext4 is the standard Linux format and works best with Raspberry Pi. FAT32 and NTFS (Windows formats) also work but have limitations — FAT32 can't store files larger than 4GB, and NTFS requires extra software. If you want to use the drive with both a Pi and a Windows computer, FAT32 is the easiest choice.
Can I use an SSD instead of a regular external hard drive?
Yes. SSDs are faster and more reliable than traditional hard drives, and they use less power. They work exactly the same way — just plug in the USB cable and follow the same mounting steps. SSDs are more expensive but worth it if you're doing heavy file transfers or running applications from the drive.
What happens if I unplug the drive without unmounting it?
You risk corrupting files or losing data. The Pi may still be writing to the drive even if you're not actively using it. Always run sudo umount ~/external_drive before unplugging, or use the file manager's "eject" option if you're on the desktop.
Can I use multiple external drives at the same time?
Yes. Plug in the second drive, identify it with lsblk, create a new mount point folder, and mount it the same way as the first. Each drive gets its own folder. You can add multiple drives to fstab so they all mount automatically on startup.