What is a Raspberry Pi NAS?
A Raspberry Pi NAS is a Raspberry Pi running file-sharing software with an external drive attached, so every device on your network can store and open files from one place. To build one you need a Raspberry Pi 4 or 5, a suitable power supply, an SD card for the operating system, a separate drive for your files, and software such as Samba.
Raspberry Pi's own NAS tutorial uses a Raspberry Pi 4 with 8 GB of RAM, Raspberry Pi OS Lite and external USB storage, and notes that a faster Pi saves data faster. This guide follows the same approach and adds the practical details around power, drives and backups. If you are still choosing between programs, start with our Raspberry Pi NAS software comparison; this post is about building the box.
What do you need to build a Raspberry Pi NAS?
| Part | What to choose | Why it matters |
|---|---|---|
| Board | Raspberry Pi 4 or Pi 5, 4 GB RAM or more | Both have Gigabit Ethernet and USB 3.0 |
| Power supply | Official supply for your model; 27 W (5 V / 5 A) for a Pi 5 | Drives draw from the Pi's USB power budget |
| Boot media | microSD card, or an NVMe drive on a Pi 5 | Holds only the operating system |
| Data drive | USB SSD, or NVMe on a Pi 5 with an M.2 HAT+ | Holds your files, separate from the OS |
| Cable and case | Ethernet cable, case with cooling | Wired network is faster and steadier than Wi-Fi |
| Backup drive | A second drive, or an off-site copy | RAID is not a backup |
Prices change often and differ by country, so check current listings rather than relying on a number here. If you already own a Pi, a drive and a cable, the extra spend can be close to nothing.
Should you build it on a Pi 4 or a Pi 5?
For network speed there is little difference, because both boards have one Gigabit Ethernet port. The differences are in how you attach storage and how much USB power is available.
| Feature | Raspberry Pi 4 | Raspberry Pi 5 |
|---|---|---|
| Network | Gigabit Ethernet | Gigabit Ethernet |
| Fast storage | USB 3.0 drives | USB 3.0, or NVMe through the M.2 HAT+ |
| NVMe link | None | Single PCIe 2.0 lane, 500 MB/s peak |
| Power for USB drives | Official 5 V / 3 A supply | 600 mA by default, 1.6 A with the 27 W supply |
The M.2 HAT+ connects an NVMe drive to the Pi 5's PCIe 2.0 interface, with a 500 MB/s peak transfer rate and support for 2230 and 2242 drives. Because a single Gigabit port tops out below that, NVMe mainly makes boot, small-file work and apps feel faster rather than raising file-copy speed over the network.
Power the drive properly. Raspberry Pi's 27 W power supply brief says the Pi 5 raises its USB current limit from a default 600 mA to 1.6 A when it detects that supply. A bus-powered hard drive that spins up and drops off the bus is usually a power problem, so use the right supply, a self-powered enclosure or a powered USB hub.
How do you build a Raspberry Pi NAS step by step?
1. Install Raspberry Pi OS Lite
Use Raspberry Pi Imager to write Raspberry Pi OS Lite (64-bit) to the SD card. In the Imager settings, set a hostname such as pinas, create a user and enable SSH. Lite has no desktop, which leaves more memory for file sharing. Boot the Pi on a wired network connection and log in over SSH.
sudo apt update
sudo apt full-upgrade -y
sudo reboot
2. Attach and format the data drive
Plug the drive into a blue USB 3.0 port and find it with lsblk. The commands below assume the drive shows up as /dev/sda with one partition, /dev/sda1. Formatting erases everything on the drive, so check the device name twice before you run the second command.
lsblk -f
sudo mkfs.ext4 -L nasdata /dev/sda1
sudo mkdir -p /mnt/nas
3. Mount it automatically at boot
Mount by UUID, not by /dev/sda1, because device names can change between boots. The nofail option stops a missing drive from blocking startup.
sudo blkid /dev/sda1
# copy the UUID, then add a line to /etc/fstab:
echo 'UUID=YOUR-UUID-HERE /mnt/nas ext4 defaults,nofail 0 2' | sudo tee -a /etc/fstab
sudo mount -a
sudo chown -R "$USER":"$USER" /mnt/nas
df -h /mnt/nas
4. Share it with Samba
Samba lets Windows, macOS, Linux and most phones open the share. Install it, give your user a Samba password, then add a share definition to the end of /etc/samba/smb.conf.
sudo apt install samba -y
sudo smbpasswd -a "$USER"
sudo nano /etc/samba/smb.conf
[nas]
path = /mnt/nas
read only = no
browseable = yes
valid users = YOUR-USERNAME
sudo systemctl restart smbd
From Windows, open \\pinas\nas in File Explorer. On macOS, use Finder, then Go, then Connect to Server and enter smb://pinas.local/nas.
5. Test the speed and the reboot
Copy a large file to the share and watch the transfer rate. Over Gigabit Ethernet, expect results in the region of 100 MB/s from a fast drive. In Jeff Geerling's Pi 5 NAS build, Samba reached about 96 MB/s writing from a Mac, 115 MB/s from Windows and 122 MB/s reading. Then reboot the Pi and confirm the share comes back by itself.
What are the limits of a Raspberry Pi NAS?
- One network port. All users share a single Gigabit link.
- No drive bays. You attach drives yourself, usually over USB, and each adds cables and power to manage.
- You are the support team. Updates, drive health and backups are your job.
- No built-in safety net. One drive is one copy of your files.
If you need many drives, hot-swap bays or a polished app store, a dedicated NAS fits better. Our guides to Synology alternatives for home and the TrueNAS alternative explain where that point is.
How should you back up a Raspberry Pi NAS?
RAID protects against a drive failing, but it is not a second copy: a deleted or corrupted file is deleted or corrupted on every drive. CISA's 3-2-1 guidance is three copies of important files, on two types of storage media, with one copy off-site. On a Pi NAS that usually means the live drive, a second drive that you plug in or schedule a copy to, and one copy somewhere else. Our home server backup strategy guide covers the options.
How do you reach a Raspberry Pi NAS from outside your home?
A Samba share is designed for your local network and should not be exposed directly to the internet. For remote access you need an approach that does not open your router to the world. Many home internet connections also sit behind CGNAT, so inbound port forwarding is not even possible.
Tunnels and relays solve this by connecting outward from your home, which works behind CGNAT. Our guide to self-hosting without port forwarding compares the approaches. Gavety is one of them: its agent makes an outbound peer-to-peer or relay connection, so remote access works without port forwarding. It gives you file browsing in a browser, sharing links, multiple users with permissions and media streaming. It does not have file sync, calendar, contacts or office editing. Gavety's stated requirement is a Raspberry Pi 4 with 4 GB of RAM or more, or another Linux machine with at least 4 GB of RAM. See Raspberry Pi cloud storage for a setup walkthrough.
Add remote access to your Pi NAS
Keep your files on your own drive and reach them from a browser, anywhere. Start on your local network for free and add remote access when you need it.
Get started →Free LAN tier for 1 user · $100 one-time consumer licence per device · $20 per user per year for remote access