Raspberry Pi 5 NAS With NVMe and Samba: Gigabit Ethernet, Not the SSD, Sets the Speed

A Raspberry Pi 5 NAS on an NVMe SSD with Samba is held to the 125 MB/s Gigabit line rate (1 Gbit/s divided by 8), and SpecPicks reports about 110-115 MB/s in real-world transfers, a third-party figure that SpecPicks says rests on no first-party benchmarking. Gigabit Ethernet, not the SSD, is therefore the limit. The official M.2 HAT+ joins the drive to the Pi 5 over a single-lane PCIe 2.0 interface with a 500 MB/s peak, four times the 125 MB/s Gigabit line rate, so drive length, power supply and RAM size decide the parts.

Four things break builds that follow older tutorials, and each has a fix below: a 2280 drive on the official HAT+, a 15W USB-C charger, a Windows 11 24H2 client, which per Raspberry.tips blocks guest access depending on the edition, and a drive over 2 TB left on an MBR partition table.

Google · Preferred Sources

Don't miss new tech stories on Google

Add Tech Insider once in the Google app and our stories appear in your news suggestions.

Add Now

Gigabit caps the share at 110-115 MB/s, so 100 GB takes about 15 minutes with any NVMe drive

The Pi 5 is the first Pi with a PCIe connector, which is what lets an NVMe SSD attach directly, according to Raspberry.tips’ Samba guide. iTechGuides lists the board’s connector as PCIe 2.0 x1, and Raspberry Pi’s launch post lists two USB 3.0 ports supporting simultaneous 5Gbps operation. One of them serves the backup drive in Step 12.

One gigabit per second is a theoretical 125 MB/s before overhead, which is below the 500 MB/s peak quoted for the M.2 HAT+, as Raspians notes. SpecPicks puts real-world transfers over the Pi 5’s Gigabit port at roughly 110-115 MB/s, which is 88% to 92% of the line rate (110 / 125 and 115 / 125). The table turns each published rate into the time to move 100 GB and 1 TB. We calculated the times ourselves, dividing 100,000 MB or 1,000,000 MB by each published rate, so they are arithmetic on published figures rather than measurements from a Pi.

CeilingRate (MB/s)100 GB1 TB
Gigabit Ethernet, real-world low11015.2 min2 h 32 min
Gigabit Ethernet, real-world high11514.5 min2 h 25 min
Gigabit Ethernet, line rate12513.3 min2 h 13 min
M.2 HAT+ PCIe 2.0 x1 peak5003.3 min33 min
USB 3.0 5 Gbps line rate6252.7 min27 min

The USB figure is the 5 Gbps line rate, 5,000 Mbit/s divided by 8. The network rows are the smallest figures in the table, and the slot and port rows sit four to five times above the 125 MB/s line rate (500 / 125 and 625 / 125).

For files shared over the network, then, NVMe does not make copies faster than a Gigabit link allows. iTechGuides says the drive’s local speed is mostly wasted during ordinary Gigabit SMB transfers. The USB 3.0 ports’ 5 Gbps line rate (625 MB/s) is also above Gigabit, so if you already own a USB SSD, speed alone is not a reason to buy NVMe. What NVMe offers is the direct PCIe attachment Raspberry.tips describes.

Some jobs do not suit a Pi 5 at all. iTechGuides lists several simultaneous high-bandwidth users, several 4K video transcodes, large arrays of directly powered hard drives and high-availability storage as poor fits, and business-critical data belongs on that list. If you do build a hard-drive array anyway, OpenMediaVault’s documentation prefers CMR drives over SMR for RAID, SnapRAID or mergerfs setups. A single SSD is one failure away from losing everything, which is why Step 12 adds a backup drive.

Parts that fit: 2230 and 2242 on the official HAT+, a longer board for 2280, and a 27W supply

Raspberry Pi says the HAT+ takes any device in the 2230 or 2242 form factor and can supply up to 3A, per its HAT+ announcement. A 2280 drive does not fit. Raspberry.tips says you need a longer board such as Pimoroni’s NVMe Base for those.

AdapterDrive lengthsSource
Raspberry Pi M.2 HAT+2230, 2242Raspberry Pi
Pimoroni NVMe Base2230 to 2280Raspberry.tips

Readers commenting on the same Raspberry Pi post report two assembly snags. The stacking header leaves the GPIO pins inaccessible, and the HAT cannot sit under other HATs. One reader also found the supplied screws too short to pass through a case base and the Pi 5 board and engage the standoffs. These are reader comments, not Raspberry Pi statements.

Power decides stability. SpecPicks says the Pi 5 wants 5V/5A (27W) under load and that a 15W generic USB-C brick will boot but throttle when the NVMe drive is active (SpecPicks’ boot guide). iTechGuides reports Raspberry Pi’s documented split: a 5V/5A supply allows up to 1.6 A for downstream USB devices, while a 3A supply restricts them to 600 mA. A bus-powered backup SSD in Step 12 therefore belongs on the 27W supply.

On cooling, SpecPicks says an in-case fan keeps the Pi in the mid-50s °C under load against 75+ °C with passive cooling. SpecPicks describes that piece as editorial synthesis with no first-party benchmarking, so treat it as their claim and compare it with your own temperature reading in Step 13.

ItemWhat to getConstraint
BoardRaspberry Pi 52GB is enough for Samba plus backups (see the cost section)
Adapter and SSDM.2 HAT+ with a 2230 or 2242 NVMe drive, or a longer board for 2280NVMe only; check length first
PowerOfficial 27W, 5V/5A supply15W bricks may throttle; 1.6 A against 600 mA for USB devices
CoolingActive cooler or a case with airflowSpecPicks: mid-50s °C with a fan, 75+ °C passive
Backup targetUSB 3.0 drive or second SSDUses one of the two USB 3.0 ports
NetworkEthernet cable to a Gigabit router portSets the speed, see above
Setup media and softwaremicroSD card, Raspberry Pi Imager, Raspberry Pi OS Lite (64-bit), Samba from aptThe card is used for first boot, and optionally as the boot drive

What it costs: a 2GB Pi 5 at $77.50 is enough for Samba, and idle power adds about $10 to $12 a year

Raspberry Pi’s price notice raised the 16GB Pi 5 by $80, to $385, on November 2, 2026, and Raspberry.tips reports the 2GB at $77.50 since October 1, 2026, which is all a Samba file server needs. The full price list by memory size is in our Pokémon RetroPie setup guide.

Running cost is small. In March 2026, Botmonster’s Pi 5 versus Intel N100 comparison listed the Pi 5 NAS at about 8 W idle with two drives and put annual idle electricity at $10 to $12 at $0.15 per kWh. As a check, 8 W over 8,760 hours is 70.1 kWh, which at $0.15 per kWh costs about $10.51, inside that range. This build has two drives as well, the SSD and the backup drive, so the figure is a fair ballpark.

Raspberry.tips’ lifecycle page reports that Raspberry Pi’s product page, product brief and longevity document say January 2036.

Steps 1 to 6: fit the HAT+, flash the OS, update the bootloader and get an NVMe drive into lsblk

Each step ends with a check. Do not move on until it passes.

Step 1: Check the parts and note the SSD serial number

Lay the parts on a non-conductive surface and touch a grounded metal object before handling the board and SSD. Confirm the drive is NVMe and that its length matches your adapter. Write down the SSD model and serial number, which you compare with nvme list in Step 5.

Check: you have the Pi 5, the adapter, an NVMe SSD, the screws and spacers, the 27W supply, an Ethernet cable and a microSD card.

Step 2: Assemble the Pi 5, the adapter and the SSD

Seat the SSD in the M.2 slot at a slight angle, press it down and secure it with the retaining screw. Fit the spacers, lift the latch on the Pi 5’s PCIe connector, slide the ribbon cable in straight and press the latch down. Then fit the cooler and the case, keeping the screw-length report above in mind. Our guide to installing an NVMe SSD shows the general seating steps with photos of the connector.

Check: the adapter sits flat on its spacers, the ribbon cable is square in the latch and the SSD screw is snug.

Step 3: Flash Raspberry Pi OS Lite with Raspberry Pi Imager

Choose Raspberry Pi 5 as the device, Raspberry Pi OS Lite (64-bit) as the OS and your microSD card as the target. Do not pick Raspberry Pi Desktop for PC and Mac: Raspberry Pi’s October 6, 2026 announcement says it is an x86_64 version of Raspberry Pi OS for Intel and AMD based computers, so it is not an image for the Pi 5. Open the customisation settings, set the hostname pinas, create a user with a strong password and turn on SSH. If you have an SSH key, paste the public key and select key-only login.

Check: Imager reports a successful write and verification.

Step 4: Boot, connect over SSH, update and check the bootloader date

Connect the Ethernet cable, insert the card and power the Pi. After about a minute, connect from your computer, using the router’s device list if the name does not resolve:

ssh [email protected]
sudo apt update
sudo apt full-upgrade -y
sudo reboot

Reconnect and run the next two commands. Raspberry Pi’s HAT+ instructions say the firmware date must be December 6, 2023 or later before you install the HAT+. If the date is earlier, run sudo raspi-config and update the bootloader there, as the instructions describe.

uname -m
sudo rpi-eeprom-update

Check: uname -m prints aarch64 and the firmware date is December 6, 2023 or later.

Step 5: Confirm the NVMe drive on the PCIe bus

Healthy output shows a Non-Volatile memory controller from lspci and a device called nvme0n1 from lsblk:

lspci
lsblk -o NAME,SIZE,MODEL,TYPE

If a third-party adapter does not identify itself, add one line to /boot/firmware/config.txt and reboot. iTechGuides adds that NVMe boot from a non-HAT+ device may also need PCIE_PROBE=1 in the bootloader settings (see the boot section below).

sudo nano /boot/firmware/config.txt
# add at the end:
dtparam=pciex1

Install the NVMe tools now, since the health checks need them:

sudo apt install -y nvme-cli smartmontools
sudo nvme list

Check: nvme list shows your drive with the model and serial number you noted in Step 1.

Step 6: Partition with GPT and format as ext4

Check the device name twice. The SD card is mmcblk0, and formatting it wipes the operating system. A new NVMe drive may arrive without a partition table, and a reader comment on Raspberry Pi’s post says no drive icon appears until it is partitioned. Raspberry.tips warns that fdisk creates an MBR table that can use only 2 TB unless you press g for GPT first. The command below always writes GPT, so the limit never applies.

sudo parted /dev/nvme0n1 --script mklabel gpt mkpart nasdata ext4 0% 100%
sudo mkfs.ext4 -L nasdata /dev/nvme0n1p1
sudo tune2fs -m 1 /dev/nvme0n1p1

The last command sets the reserved blocks to 1% of the partition. This build uses ext4 for the data partition.

Check: lsblk -f shows nvme0n1p1 as ext4 with the label nasdata.

Steps 7 to 10: mount by UUID with nofail, a named-user Samba share, and a check from each client

Step 7: Mount the SSD permanently by UUID

Find the UUID, create the mount point and add a line to /etc/fstab. Raspberry.tips explains the options: noatime improves performance, and nofail makes sure the Pi still boots if the SSD is missing.

sudo blkid /dev/nvme0n1p1
sudo mkdir -p /srv/nas
sudo nano /etc/fstab
# add at the bottom, with your real UUID:
UUID=YOUR-UUID-HERE  /srv/nas  ext4  defaults,noatime,nofail  0  2

sudo systemctl daemon-reload
sudo mount -a
df -h /srv/nas

Check: df -h /srv/nas shows the SSD’s capacity, and it still does after a reboot.

Step 8: Create the group, user and folders

Samba keeps its own password database. Create one group for NAS users, a user that cannot log in to a shell (swap alice for your name) and two folders. The leading 2 in 2770 sets the setgid bit, so new files inherit the nasusers group and every user can edit what the others save. To reuse an existing login, run sudo usermod -aG nasusers youruser instead of useradd.

sudo groupadd nasusers
sudo useradd -M -s /usr/sbin/nologin -G nasusers alice
sudo mkdir -p /srv/nas/files /srv/nas/media
sudo chown -R root:nasusers /srv/nas
sudo chmod -R 2770 /srv/nas

Check: ls -ld /srv/nas/files shows drwxrws--- with the group nasusers.

Step 9: Install Samba and write the configuration

Windows clients are stricter than older ones. As of November 12, 2026, Microsoft’s SMB signing page says Windows Server 2025 requires outbound SMB signing only and Windows 11 24H2 Home requires neither direction, and it states: “Windows 11, version 24H2 Enterprise, Pro, and Education require both outbound and inbound SMB signing.” On the same date, Raspberry.tips says Windows 11 version 24H2 and later, depending on the edition, requires signed SMB connections and blocks guest access. A 24H2 client therefore does not fall back to a guest login, and the config below has no guest share: map to guest = never and named users only. It also rejects SMB1, as Raspberry.tips’ own configuration does with min protocol = SMB2, and uses the fruit module for macOS. Set the hosts allow subnet to yours (check with ip -4 addr).

sudo apt install -y samba
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.orig
sudo nano /etc/samba/smb.conf
[global]
   workgroup = WORKGROUP
   server string = Pi NAS
   server role = standalone server
   security = user
   map to guest = never
   server min protocol = SMB2_02
   client min protocol = SMB2_02
   server smb encrypt = desired
   hosts allow = 127.0.0.1 192.168.1.0/24
   hosts deny = 0.0.0.0/0
   log file = /var/log/samba/log.%m
   max log size = 1000
   load printers = no
   printing = bsd
   printcap name = /dev/null
   disable spoolss = yes
   vfs objects = fruit streams_xattr
   fruit:metadata = stream
   fruit:model = MacSamba
   fruit:posix_rename = yes
   fruit:veto_appledouble = no
   fruit:nfs_aces = no
   fruit:wipe_intentionally_left_blank_rfork = yes
   fruit:delete_empty_adfiles = yes

[files]
   path = /srv/nas/files
   browseable = yes
   read only = no
   valid users = @nasusers
   force group = nasusers
   create mask = 0660
   directory mask = 2770

[media]
   path = /srv/nas/media
   browseable = yes
   read only = yes
   valid users = @nasusers
   write list = alice
   force group = nasusers
   create mask = 0660
   directory mask = 2770
testparm -s
sudo systemctl enable --now smbd
sudo systemctl restart smbd
sudo smbpasswd -a alice

The smbpasswd password applies only to network file access, and changing the Linux password does not change it.

Check: testparm -s prints the shares without errors and systemctl status smbd says active (running).

Step 10: Connect from Windows, macOS and Linux

Use the Pi’s hostname or IP address and the Samba user, never a guest login. On Windows, type this into the File Explorer address bar, or right-click This PC, choose Map network drive and tick Reconnect at sign-in:

\\pinas\files

On macOS, press Command and K in Finder and enter the address below. On Linux, mount it with the cifs-utils package:

smb://pinas.local/files

sudo apt install -y cifs-utils
sudo mkdir -p /mnt/pinas
sudo mount -t cifs //pinas.local/files /mnt/pinas -o username=alice,uid=$(id -u),gid=$(id -g)

Check: you can create, rename and delete a file in the files share from every client you own.

Optional: a separate Time Machine share for Macs

Do not point Time Machine at the files share, because it can fill the disk. The Samba vfs_fruit manual describes the Time Machine size option as limiting the reported disk size, which stops Time Machine from using the whole real disk space for backup. Create a folder, append a share like the one below to smb.conf, set the cap below the space you can spare, restart Samba and pick the share in Time Machine settings. The one-script section further down does not include this share.

sudo mkdir -p /srv/nas/timemachine
sudo chown root:nasusers /srv/nas/timemachine
sudo chmod 2770 /srv/nas/timemachine

# append to /etc/samba/smb.conf:
[timemachine]
   path = /srv/nas/timemachine
   read only = no
   valid users = @nasusers
   force group = nasusers
   create mask = 0660
   directory mask = 2770
   fruit:time machine = yes
   fruit:time machine max size = 500G

testparm -s
sudo systemctl restart smbd

Check: testparm -s prints the timemachine share without errors and the Mac lists it as a backup destination.

Steps 11 to 13: a reserved IP and firewall, nightly rsync snapshots, and a speed check that should read 110-115 MB/s

Step 11: Reserve the address and lock down the network

Create a DHCP reservation for the Pi in your router so mapped drives keep working. Then enable the firewall, adding the SSH rule first so you do not lock yourself out. Port 445 carries SMB, port 22 carries SSH and port 5353 lets pinas.local resolve. Raspians’ advice for remote access is blunt: “Do not expose the NAS to the internet by forwarding a port to it.” Use a VPN instead.

sudo apt install -y ufw unattended-upgrades
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow from 192.168.1.0/24 to any port 22 proto tcp
sudo ufw allow from 192.168.1.0/24 to any port 445 proto tcp
sudo ufw allow from 192.168.1.0/24 to any port 5353 proto udp
sudo ufw enable
sudo ufw status verbose
sudo dpkg-reconfigure -plow unattended-upgrades

The last command turns on automatic updates for an always-on box. Debian’s security page says the unattended-upgrades package keeps the computer current with the latest security (and other) updates automatically. If you chose key-only login in Imager, confirm that SSH password logins are off:

sudo sshd -T | grep -i passwordauthentication

Check: sudo ufw status lists the three allow rules, a phone on guest Wi-Fi cannot see the share, and, if you chose key-only login, the sshd -T line ends in no.

Step 12: Nightly snapshot backups to the USB drive

RAID is not a backup, and a single SSD is one failure away from losing everything. CISA’s 3-2-1 rule is 3 copies of important files, on 2 different types of storage media, with 1 copy off-site. The snapshots below give you a second copy on a second device, so keep a third copy off-site to meet it.

Plug the USB drive into a USB 3.0 port, format it as ext4 (hard links and Linux permissions need it) and mount it at /mnt/backup by UUID as in Step 7. Power matters here: on the 27W supply the USB ports allow 1.6 A. Create the script with sudo nano /usr/local/bin/pinas-backup.sh:

#!/usr/bin/env bash
set -euo pipefail

SRC=/srv/nas/files/
DEST=/mnt/backup/snapshots
STAMP=$(date +%F)
KEEP=14

trap 'echo "backup $STAMP failed" >&2' ERR

mountpoint -q /mnt/backup || { echo "backup drive not mounted" >&2; exit 1; }
mkdir -p "$DEST"

if [ -d "$DEST/$STAMP" ]; then
  echo "snapshot $STAMP already exists"
  exit 0
fi

LATEST=$(ls -1 "$DEST" | grep -v partial | sort | tail -n 1 || true)
LINK=()
if [ -n "$LATEST" ]; then
  LINK=(--link-dest="$DEST/$LATEST")
fi

rsync -aHAX --delete "${LINK[@]}" "$SRC" "$DEST/$STAMP.partial/"
mv "$DEST/$STAMP.partial" "$DEST/$STAMP"

ls -1 "$DEST" | grep -v partial | sort | head -n -"$KEEP" | while read -r old; do
  rm -rf "${DEST:?}/$old"
done
echo "snapshot $STAMP complete"

The script covers the files share only; add a second rsync line for media if you want it protected. --link-dest hard-links unchanged files to the previous snapshot, so each daily snapshot looks like a full copy but stores only what changed, and the script keeps 14 of them. Make it executable and add a service and a timer:

sudo chmod +x /usr/local/bin/pinas-backup.sh
sudo nano /etc/systemd/system/pinas-backup.service
sudo nano /etc/systemd/system/pinas-backup.timer
# pinas-backup.service
[Unit]
Description=Pi NAS snapshot backup

[Service]
Type=oneshot
ExecStart=/usr/local/bin/pinas-backup.sh

# pinas-backup.timer
[Unit]
Description=Run the Pi NAS backup nightly

[Timer]
OnCalendar=*-*-* 02:30:00
Persistent=true

[Install]
WantedBy=timers.target
sudo systemctl daemon-reload
sudo systemctl enable --now pinas-backup.timer
sudo systemctl start pinas-backup.service
systemctl list-timers pinas-backup.timer
ls /mnt/backup/snapshots

Persistent=true makes systemd run a missed backup after the Pi returns from a power cut.

Check: a dated folder appears in /mnt/backup/snapshots and the timer shows a next run time.

Step 13: Monitor health and check the speed

sudo nvme smart-log /dev/nvme0
sudo smartctl -a /dev/nvme0
vcgencmd measure_temp
vcgencmd get_throttled
echo '/dev/nvme0 -a -s (S/../.././03) -m root' | sudo tee -a /etc/smartd.conf
sudo systemctl enable --now smartmontools

In the SMART log, critical_warning should be 0; also watch percentage_used and media_errors. get_throttled returns throttled=0x0 on a healthy system, and anything else points to undervoltage or heat. Then copy a large file to and from the share from a wired client. Going by the sources above, the result should land near 110-115 MB/s, and a lower figure points first to the cable, the router port or a Wi-Fi connection.

A local test on the Pi measures the drive and the PCIe lane, not the share, and should read higher than the network figure:

dd if=/dev/zero of=/srv/nas/files/test.bin bs=1M count=4096 oflag=direct status=progress
dd if=/srv/nas/files/test.bin of=/dev/null bs=1M iflag=direct status=progress
rm /srv/nas/files/test.bin

Check: SMART shows critical_warning: 0, get_throttled returns 0x0 and the wired copy sits near the Gigabit limit.

One script for the storage, Samba and firewall steps

Steps 6 to 11 fit in one script for rebuilding after an SD card failure. It takes the device name as an argument, refuses to touch the drive that holds the running system, asks you to type the device name before it erases anything, validates the Samba config in a temporary directory before installing it, and removes that directory on exit. Backups and monitoring stay separate because they depend on a second drive.

#!/usr/bin/env bash
set -euo pipefail

NAS_USER="${1:?usage: sudo ./pinas-setup.sh USERNAME LAN_CIDR NVME_DEVICE}"
LAN="${2:?usage: sudo ./pinas-setup.sh USERNAME LAN_CIDR NVME_DEVICE  (LAN_CIDR e.g. 192.168.1.0/24)}"
DEV="${3:?usage: sudo ./pinas-setup.sh USERNAME LAN_CIDR NVME_DEVICE  (NVME_DEVICE e.g. /dev/nvme0n1)}"
PART="${DEV}p1"
MNT=/srv/nas
GROUP=nasusers
WORK="$(mktemp -d)"

cleanup() { rm -rf "$WORK"; }
trap cleanup EXIT
trap 'echo "Setup stopped at line $LINENO. Fix the error and run it again." >&2' ERR

if [ "$(id -u)" -ne 0 ]; then
  echo "Run as root: sudo $0 $*" >&2
  exit 1
fi
[ -b "$DEV" ] || { echo "$DEV is not a block device" >&2; exit 1; }
if lsblk -nr -o MOUNTPOINT "$DEV" | awk '$1=="/"{f=1} END{exit !f}'; then
  echo "$DEV holds the running system. Pass the data drive instead." >&2
  exit 1
fi

apt-get update
apt-get install -y samba ufw smartmontools nvme-cli rsync parted

PART_FS="$(blkid -o value -s TYPE "$PART" 2>/dev/null || true)"
if [ "$PART_FS" != "ext4" ]; then
  if [ "${FORCE:-0}" != "1" ] && [ -n "$(lsblk -nr -o FSTYPE "$DEV" | tr -d '[:space:]')" ]; then
    echo "$DEV already holds a filesystem. Re-run with FORCE=1 to wipe it." >&2
    exit 1
  fi
  lsblk -o NAME,SIZE,MODEL "$DEV"
  read -r -p "This erases $DEV. Type the device name to continue: " ANSWER
  [ "$ANSWER" = "$DEV" ] || { echo "Cancelled." >&2; exit 1; }
  parted "$DEV" --script mklabel gpt mkpart nasdata ext4 0% 100%
  partprobe "$DEV"
  udevadm settle
  mkfs.ext4 -L nasdata "$PART"
  tune2fs -m 1 "$PART"
fi

mkdir -p "$MNT"
UUID="$(blkid -s UUID -o value "$PART")"
if ! grep -q "$UUID" /etc/fstab; then
  echo "UUID=$UUID  $MNT  ext4  defaults,noatime,nofail  0  2" >> /etc/fstab
fi
systemctl daemon-reload
mount -a
mountpoint -q "$MNT" || { echo "$MNT did not mount" >&2; exit 1; }

groupadd -f "$GROUP"
if id "$NAS_USER" >/dev/null 2>&1; then
  usermod -aG "$GROUP" "$NAS_USER"
else
  useradd -M -s /usr/sbin/nologin -G "$GROUP" "$NAS_USER"
fi
mkdir -p "$MNT/files" "$MNT/media"
chown -R root:"$GROUP" "$MNT"
chmod -R 2770 "$MNT"

cat > "$WORK/smb.conf" <<EOF
[global]
   workgroup = WORKGROUP
   server string = Pi NAS
   server role = standalone server
   security = user
   map to guest = never
   server min protocol = SMB2_02
   client min protocol = SMB2_02
   server smb encrypt = desired
   hosts allow = 127.0.0.1 $LAN
   hosts deny = 0.0.0.0/0
   log file = /var/log/samba/log.%m
   max log size = 1000
   load printers = no
   printing = bsd
   printcap name = /dev/null
   disable spoolss = yes
   vfs objects = fruit streams_xattr
   fruit:metadata = stream
   fruit:model = MacSamba
   fruit:posix_rename = yes
   fruit:nfs_aces = no

[files]
   path = $MNT/files
   read only = no
   valid users = @$GROUP
   force group = $GROUP
   create mask = 0660
   directory mask = 2770

[media]
   path = $MNT/media
   read only = yes
   valid users = @$GROUP
   write list = $NAS_USER
   force group = $GROUP
   create mask = 0660
   directory mask = 2770
EOF

testparm -s "$WORK/smb.conf" >/dev/null
[ -f /etc/samba/smb.conf.orig ] || cp /etc/samba/smb.conf /etc/samba/smb.conf.orig
install -m 644 "$WORK/smb.conf" /etc/samba/smb.conf
systemctl enable --now smbd
systemctl restart smbd

ufw default deny incoming
ufw default allow outgoing
ufw allow from "$LAN" to any port 22 proto tcp
ufw allow from "$LAN" to any port 445 proto tcp
ufw allow from "$LAN" to any port 5353 proto udp
ufw --force enable

echo "Set the Samba password for $NAS_USER now:"
smbpasswd -a "$NAS_USER"
echo "Done. Test with: smbclient -L localhost -U $NAS_USER"
chmod +x pinas-setup.sh
sudo ./pinas-setup.sh alice 192.168.1.0/24 /dev/nvme0n1

Booting from the NVMe, the PCIe Gen 3 switch, and the repairs for a drive that won’t show or a share that won’t open

Boot from the NVMe drive

Raspberry Pi’s HAT+ post covers the route: format the drive with Raspberry Pi Imager, then in sudo raspi-config choose Advanced Options, then Boot Order, then NVMe/USB boot. For a third-party HAT, iTechGuides says the documented bootloader settings include BOOT_ORDER=0xf416 and PCIE_PROBE=1. Steps 6 to 11 assume a data-only SSD with the OS on the microSD card. If you boot from the SSD, skip the parted and mkfs.ext4 commands in Step 6, because they erase the whole drive including the OS, and put the share on a separate drive or on a new partition in free space (check its name with lsblk and use it in Steps 7 and 8).

One precaution if you convert a drive that already boots the Pi from MBR to GPT: compare the PARTUUID entries in cmdline.txt and /etc/fstab with the output of blkid before you reboot.

Skip forced PCIe Gen 3 on a Gigabit NAS

Adding dtparam=pciex1_gen=3 to config.txt forces Gen 3. SpecPicks says it gives about 800 MB/s more sequential throughput but takes the interface outside its officially validated envelope, and that on some drive and HAT combinations it corrupts data; it advises testing with fio first. The network port can carry 125 MB/s at most, so the extra 800 MB/s cannot reach the network and the risk buys nothing here.

Drive missing, share refused, copy slow: causes and repairs

SymptomLikely causeFix
NVMe drive missing from lspci and lsblkRibbon cable not square, firmware older than December 6, 2023, or a third-party adapter that does not identify itselfReseat the cable, update the bootloader (Step 4), add dtparam=pciex1; for boot from a non-HAT+ device add PCIE_PROBE=1. Try another SSD if you can.
Drive appears but no volumeNo partition table on a new SSDPartition and format as in Step 6
Transfers slow or the Pi throttlesWi-Fi, a poor cable or router port, or a 15W supplyUse a wired Gigabit link, run vcgencmd get_throttled, switch to the 27W supply, and compare a local dd result with the share speed
Windows says access is denied or refuses to connectWindows 11 24H2 Pro, Enterprise and Education require SMB signing per Microsoft; Raspberry.tips says 24H2 blocks guest access, depending on edition; or cached credentialsConnect with the Samba user, not as guest. Remove stored entries for pinas in Credential Manager. Confirm the user with sudo pdbedit -L and id alice.
Share missing from the Windows Network viewBrowsing is not how this build is reachedType \\pinas\files or map the drive
macOS cannot connect, or Finder is slowMissing fruit lines, stale Keychain entry, or Icon view on a huge folderUse smb://pinas.local/files, confirm the fruit lines, delete the saved connection in Keychain Access, switch to List view
Time Machine fills the diskTime Machine pointed at the files share, or no size cap on its own shareUse the separate timemachine share and set fruit:time machine max size below the space you can spare
Samba will not start after an editTypo in smb.confRun testparm -s, read sudo journalctl -u smbd -n 50, restore /etc/samba/smb.conf.orig and reapply the edits one block at a time
Pi drops to emergency mode after an fstab editWrong UUID, or PARTUUID out of date after a GPT conversionKeep nofail; re-run blkid and compare; or fix /etc/fstab from another computer with the SD card mounted
SSH blocked after enabling the firewallPort 22 rule missing or wrong subnetAttach a keyboard and screen, run sudo ufw allow 22/tcp temporarily and correct the subnet. Always add the SSH rule before ufw enable.
Permission denied when saving in a subfolderFolder lost its setgid bit after a restore or manual copysudo find /srv/nas -type d -exec chmod 2770 {} + then sudo chown -R root:nasusers /srv/nas
Backup timer never runsBackup drive not mounted at boot, which the script reports on purposeCheck systemctl list-timers and journalctl -u pinas-backup.service
Nothing failed and you want proof the build worksNo fault to repairA wired copy of a large file lands near 110-115 MB/s, critical_warning reads 0 in nvme smart-log and get_throttled returns 0x0
Marcus Chen

Marcus Chen

PC hardware, storage and engineering

Marcus Chen covers PC hardware, storage and engineering for Tech Insider: processors, graphics cards, SSDs and hard drives, home servers and backup, and the engineering choices behind them. He builds comparisons from manufacturers' specifications, published independent test results and Tech Insider's own calculations, and writes plainly about what the evidence supports.

View all articles