How do you mount external drives on a Raspberry Pi?

ampheoampheo
2 min read

Mounting external drives on a Raspberry Pi (like USB flash drives or external HDDs/SSDs) is a common and useful task — especially for projects like file servers, media centers, or data logging. Here's a step-by-step guide:


1. Connect the External Drive

  • Plug your USB drive into one of the Pi’s USB ports.

  • Power it externally if it's a large 2.5"/3.5" HDD (Raspberry Pi may not provide enough power).


2. Identify the Drive

Open Terminal and type:

bash

lsblk

or

bash

sudo fdisk -l

Look for a device like:

bash

/dev/sda1     15G  ...

That’s your external drive.


3. Create a Mount Point

Choose where the drive should be accessible from. Example:

bash

sudo mkdir /mnt/mydrive

4. Mount the Drive Manually

For NTFS or exFAT (e.g., Windows drives):

Install support:

bash

sudo apt install ntfs-3g exfat-fuse exfat-utils

Then mount:

bash

sudo mount -t auto /dev/sda1 /mnt/mydrive

For ext4 (Linux format):

bash

sudo mount /dev/sda1 /mnt/mydrive

5. Auto-Mount on Boot (Optional)

Edit the fstab file:

bash

sudo nano /etc/fstab

Add a line like:

bash

/dev/sda1  /mnt/mydrive  auto  defaults,nofail  0  0

Use UUID instead of /dev/sda1 if you want a more stable reference:

bash

sudo blkid

Then update fstab with:

ini

UUID=xxxx-xxxx  /mnt/mydrive  auto  defaults,nofail  0  0

Tips

  • Use sudo umount /mnt/mydrive before unplugging.

  • For read/write access, ensure correct permissions:

bash

sudo chown -R pi:pi /mnt/mydrive

Summary Table

StepCommand ExamplePurpose
Identifylsblk or sudo fdisk -lFind drive name (e.g., sda1)
Mount Pointsudo mkdir /mnt/mydriveCreate location for mount
Mountsudo mount /dev/sda1 /mnt/mydriveAttach the drive manually
AutomountEdit /etc/fstabMake drive mount at boot
Unmountsudo umount /mnt/mydriveSafe removal
0
Subscribe to my newsletter

Read articles from ampheo directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

ampheo
ampheo