Turning a Raspberry Pi 5 into a NAS with a PCIe hat

The Pi finally has a real bus, and that changes what "just use a Pi" means

Contents

For a decade, “Raspberry Pi NAS” meant a USB 3.0 hub, a couple of external drives, and a faint sense you were fighting the hardware instead of using it. The Pi’s storage path ran through USB, which meant every read and write competed with whatever else was hanging off that same controller, and throughput topped out well short of what a single decent SATA SSD could actually deliver. It worked. It was never comfortable.

The Raspberry Pi 5 changes the equation because it exposes a genuine PCI Express lane on the board, and a small ecosystem of hats has grown up around it that turn that lane into NVMe slots, SATA controllers, or both. I put one together as a real file server — a box that now holds backups, a media library, and Samba shares for two other machines in the house, not a toy — and it earns its place in a way the USB-drive Pi never quite did.

Why the PCIe lane matters more than the CPU

The Pi 5’s quad-core Cortex-A76 is a decent step up from the A72 in the Pi 4, but for a NAS the CPU was never the bottleneck. Samba and NFS are not CPU-hungry at home-network speeds, and even ZFS checksumming barely troubles a modern ARM core at gigabit rates. The bottleneck was always the storage path, and that’s exactly what changed.

The Pi 5 has a single PCIe 2.0 x1 lane broken out to a small FPC connector near the USB-C port. PCIe 2.0 x1 tops out around 500MB/s in each direction, which sounds unglamorous next to a desktop’s PCIe 4.0 x16, but it’s roughly the same ceiling as a SATA III port and the same single-lane ceiling that sits behind the Pi 4’s USB 3.0 ports, except that here one drive has the lane to itself instead of sharing it with everything on the USB bus. Some hats re-clock the lane to PCIe 3.0 speeds unofficially — Raspberry Pi doesn’t guarantee it works, but in practice most NVMe hats on the market run fine at the higher speed with a one-line config change, and mine has been stable at PCIe 3.0 x1 for months.

That single lane is the whole story. Everything downstream — an NVMe M.2 slot, a four-port SATA controller, a two-bay hat with its own RAID chip — is built on top of a PCIe switch or bridge chip that fans the one lane out. You are never going to saturate four SATA drives simultaneously through it, but you were never going to do that with a Pi’s power budget either.

RaspberryPi 5One PCIe laneHat bridgeor switchNVMe slotSATA ports2.5GbE NICon some hatsAll three share the one lane
Everything on the hat competes for that one lane.

The build

I went with a hat that exposes both an M.2 NVMe slot and a two-port SATA breakout via a JMicron bridge chip, mounted directly onto the Pi 5’s GPIO header and PCIe FPC connector, with its own official-style case that stacks the drives above the board. The bill of materials:

A Raspberry Pi 5 board seen from above with a heatsink and active cooler fitted.
A Raspberry Pi 5 with the official active cooler fitted; the PCIe hat is not shown. Photo: Raspberry Pi 5 with active cooler by SimonWaldherr, CC BY 4.0, via Wikimedia Commons.
  • Raspberry Pi 5, 8GB
  • PCIe/NVMe + dual-SATA hat (JMB585-based bridge)
  • 1TB NVMe drive for the OS and fast scratch space
  • Two 4TB 2.5" SATA SSDs for the bulk pool, mirrored
  • Official 27W USB-C power supply — this matters more than it sounds

That last point is not a throwaway. Two SATA SSDs plus an NVMe drive plus the Pi itself can pull enough current at spin-up and under load that an underspecced power supply causes brownout resets, which look exactly like random filesystem corruption until you check dmesg and find undervoltage warnings. Use the official supply or a verified 5V/5A equivalent; this is the single most common cause of “my Pi NAS randomly crashes” reports.

Setting it up

Raspberry Pi OS boots from the NVMe drive directly now — no more juggling an SD card as a bootloader stepping stone. Flash the OS to the NVMe drive with Raspberry Pi Imager, set the boot order in raspi-config to prefer NVMe, and the SD card slot becomes optional; I keep a card in as a recovery fallback and nothing else.

The two SATA SSDs get mirrored with ZFS rather than mdadm, mostly because ZFS’s scrub and snapshot tooling is worth the extra RAM overhead on an 8GB board, and because I already run ZFS everywhere else in the house and don’t want a second mental model for storage:

1
2
3
4
5
6
sudo apt install zfsutils-linux
sudo zpool create -o ashift=12 storage mirror /dev/sda /dev/sdb
sudo zfs set compression=lz4 storage
sudo zfs set atime=off storage
sudo zfs create storage/media
sudo zfs create storage/backups

ashift=12 matters — it tells ZFS to align to 4K sectors, which the SATA SSDs report correctly but which ZFS won’t always detect on its own depending on how the bridge chip presents the drives. Skipping it doesn’t break anything immediately; it just quietly costs you write amplification you won’t notice until a scrub takes twice as long as it should.

What the throughput actually looks like

Measured with fio running sequential reads and writes against the ZFS mirror, sustained throughput sits around 380–420MB/s, comfortably above gigabit Ethernet’s real-world ceiling of roughly 110MB/s. In other words, on a single gigabit link the network is the bottleneck, not the storage — which is the point. The PCIe lane doesn’t need to be fast in absolute terms, it needs to stop being the fastest thing you’ll never hit, and it now is.

Gigabit Ethernet125 MB/s2.5GbE312 MB/sPCIe 2.0 x1 (Pi 5)500 MB/sSATA III600 MB/sPCIe 3.0 x1985 MB/sSource: PCIe and SATA line rates (Wikipedia);Ethernet 1000 and 2500 Mbit/s divided by 8
The Pi 5’s official lane outruns a gigabit link four times over.

Where it gets interesting is 2.5GbE. The Pi 5 doesn’t have onboard 2.5 gigabit, but some hats combine the PCIe switch with a spare lane for a 2.5GbE NIC alongside the storage controller, at the cost of splitting bandwidth across both. On the combined hat I tested for comparison, throughput to a single client over 2.5GbE topped out around 240MB/s rather than the 280MB/s the link theoretically allows, because the NVMe/SATA controller and the network controller are contending for the same upstream lane. If you want both fast storage and fast networking on a Pi 5, you’re choosing which one gets priority, not getting both at full speed simultaneously.

Troubleshooting the things that actually go wrong

The hat isn’t detected at boot. Check dmesg | grep -i pcie for link training failures. The FPC ribbon cable connecting the hat to the Pi’s PCIe connector is fragile and easy to seat at a slight angle; reseating it fixes the majority of “PCIe device not found” reports. Confirm PCIe is enabled at all — some Pi OS images ship with it off by default — via:

1
2
sudo raspi-config
# Advanced Options → PCIe Speed

Boot works but throughput is USB-2.0-level. This usually means the hat negotiated PCIe 1.0 speeds instead of 2.0 or 3.0. Check the negotiated link speed:

1
sudo lspci -vv | grep -A2 LnkSta

If it reports 2.5GT/s instead of 5GT/s or 8GT/s, the hat vendor’s overlay for forcing a higher-speed link either isn’t applied or isn’t supported on your firmware revision. Update rpi-eeprom and the bootloader firmware first; a surprising number of speed problems trace back to an outdated EEPROM that predates proper PCIe Gen 3 negotiation support.

Drives drop out under sustained load. Almost always thermal or power, not the drives themselves. The bridge chip on cheaper hats runs hot enough to throttle or reset under sustained sequential writes without a heatsink; add one, or add airflow. If it persists after cooling, go back to the power supply question above — SSDs draw more current on sustained writes than at idle, and marginal supplies fail exactly when you’re stress-testing.

Picking a hat: the three shapes on the market

By the time I bought mine, the Pi 5 PCIe hat market had settled into three rough categories, and it’s worth knowing which one you’re buying before the parcel arrives.

The first is the single M.2 NVMe hat — cheapest, simplest, and the one Raspberry Pi’s own official M.2 HAT+ falls into. It gives you one fast drive and nothing else, which is plenty if your plan is “one big NVMe drive, backed up somewhere else,” but it isn’t really a NAS shape at all; it’s a Pi with fast local storage.

The second is the SATA breakout hat, usually built around a JMicron or ASMedia bridge chip fanning the single PCIe lane out to two or four SATA ports. This is the NAS shape — multiple drives, a real RAID or mirror pool, hot-swap trays on the fancier versions. It’s what I built with, and it’s the sweet spot for anyone who wants redundancy without needing NVMe-class speed for every file.

The third is the combined hat: NVMe slot plus SATA ports plus sometimes a 2.5GbE NIC, all sharing the one PCIe lane through a switch chip. These are the most versatile on paper and the most oversold in practice — the lane-sharing bottleneck discussed above applies in full, and the marketing rarely mentions that running storage and fast networking simultaneously means both get less than their rated ceiling. Buy one of these only if you’ve made peace with that trade-off rather than discovering it after the fact.

The three shapes side by side.

Hat shapeStorageLane sharingSuits
Single M.2 NVMeOne NVMe driveNoneOne fast drive backed up elsewhere
SATA breakoutTwo or four SATA portsDrives share the laneA mirrored pool
CombinedNVMe and SATA, sometimes 2.5GbEStorage and network share itBuyers who accept that trade-off

None of them are officially blessed by Raspberry Pi for PCIe 3.0 speeds — the board’s PCIe controller is only certified for 2.0 — so if a listing promises Gen 3 performance, that’s the vendor’s own overlay overclocking the link, not a Raspberry Pi guarantee. It has worked reliably for me and for most people reporting on it, but it is unofficial, and a firmware update could in principle change that behaviour.

Sharing it out: Samba and the snapshot habit

Storage that nobody else on the network can reach is just a hard drive with extra steps, not a NAS. Samba remains the least friction-prone way to get Windows, macOS and Linux clients all talking to the same shares without separate configuration on each:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
[media]
   path = /storage/media
   browseable = yes
   read only = no
   valid users = @nasusers
   force group = nasusers
   create mask = 0664
   directory mask = 0775

[backups]
   path = /storage/backups
   browseable = yes
   read only = no
   valid users = @nasusers

Create the group and drop your regular user accounts into it rather than exposing the shares to guest ok = yes — an open share on a home network is a bad habit that eventually bites you when a guest device or a compromised IoT gadget on the same subnet starts poking around. If you’re segmenting IoT traffic away from trusted devices already, the VLAN segmentation write-up covers exactly this kind of blast-radius thinking, and it’s the right companion piece to read alongside this one before you put real data on the box.

ZFS’s snapshot mechanism is the other half of making this a NAS rather than a fragile storage experiment. A cron-driven snapshot every few hours costs almost nothing in space thanks to copy-on-write, and it turns “I overwrote the wrong file” from a disaster into a thirty-second recovery:

1
2
3
4
5
sudo zfs snapshot storage/media@$(date +%Y%m%d-%H%M)
# list snapshots
zfs list -t snapshot
# roll a file back without touching the live dataset
cp /storage/media/.zfs/snapshot/20260805-0900/photo.jpg ./restored.jpg

A snapshot is not a backup — it lives on the same pool and the same physical box, so a dead Pi or a fire takes both out together. I still push the backups dataset offsite nightly with zfs send over SSH to a second machine, which is the boring, unglamorous step that actually matters more than any of the hardware choices above.

The running cost, honestly

Idle power draw for the whole assembly — Pi 5, hat, NVMe boot drive, two SATA SSDs — sits around 6-8W measured at the wall, rising to roughly 12W under sustained read/write load. At typical UK electricity prices that’s a few pounds a year to run continuously, which is the argument that actually sells a Pi NAS over a repurposed desktop or an off-the-shelf appliance drawing 25-40W idle: it’s not that the Pi is more capable, it’s that for a mirrored pair of SSDs and a gigabit link, you were never going to use the extra capability anyway, so you may as well not pay to power it.

Where it still falls short of a real NAS

It’s not a ZFS box with ECC RAM and ten drive bays, and it shouldn’t be judged as one. The single PCIe lane is a genuine ceiling: you will never run six SSDs at full speed off it, and anyone planning a large multi-drive array should be looking at a proper NAS chassis or a mini-PC with actual PCIe x4 or x8 slots — the sort of comparison covered in the Odroid H4 vs Raspberry Pi 5 write-up if you want the wider field. The Pi also has no ECC memory, which matters if you’re trusting ZFS with data you can’t afford to lose silently — non-ECC ZFS is still better than no checksumming at all, but it’s not the enterprise guarantee people sometimes assume ZFS gives them for free.

What it is now, that it wasn’t before, is a genuinely competent small NAS for the price. A mirrored two-SSD pool serving backups and a media library to a few gigabit clients, sipping under 10W at idle, fitting in a case the size of a paperback — that’s a real workload running on real storage, not a USB dongle pretending to be one. If your NAS ambitions are “a few TB, mirrored, quiet, cheap to run,” the Pi 5 with a PCIe hat now actually clears that bar, which is more than could honestly be said for any Pi before it. Anyone weighing it against a dedicated storage HBA in a bigger box should read the LSI 9211-8i write-up first — the trade-off is capacity and expandability against the Pi’s size and power draw, and for a lot of home setups the Pi now wins that trade.

Smarc
Written by Smarc

Founder and editor of Aside House. A lifelong tinkerer who self-hosts far more than is sensible, hardens Linux boxes for fun, and prods the latest AI tools to see what they can really do. The how-to guides here are the notes Smarc wishes had existed the first time round.

Smarc is the editor of Aside House. The homelab, the hardware and the opinions are real; the guides are drafted with AI assistance. Infrastructure details are genericised on purpose.