Commercial Network Attached Storage (NAS) appliances from proprietary vendors are frequently expensive, lock your disks into customized RAID file systems, and restrict the software you can run on the hardware. For households and small teams needing shared document folders, seamless Apple Time Machine backups, and central media storage, a Raspberry Pi paired with external USB 3.0 storage delivers an exceptionally capable, low-power, and cost-effective file server.

Samba is the industry-standard open-source implementation of the SMB/CIFS networking protocol. It enables seamless file sharing across macOS, Windows, Linux, iOS, and Android devices simultaneously.

This guide walks you through hardware requirements, preparing and formatting external storage drives with ext4, mounting drives permanently via UUID in /etc/fstab, configuring user permissions, crafting an optimized smb.conf with Apple Time Machine support, connecting client devices, and monitoring your storage server with Open Pi.

Hardware planning and storage architecture

A reliable file server requires careful consideration of storage drives, interface bandwidth, and power distribution:

  • Raspberry Pi Model: A Raspberry Pi 5 or Raspberry Pi 4 is strongly recommended. Both models feature true gigabit Ethernet controllers and dedicated USB 3.0 buses (offering theoretical throughput up to 5 Gbps), allowing network read and write speeds exceeding 100+ MB/s over wired Ethernet. Older Pi models (like the Pi 3B) share Ethernet bandwidth over an internal USB 2.0 hub, severely bottlenecking storage throughput to ~30 MB/s.
  • Drive Selection: Do not attempt to use a microSD card as a shared network drive. Use an external USB 3.0 SSD or a desktop external hard drive. If using 3.5-inch hard drives or multi-disk enclosures, ensure the drive enclosure has its own independent external power adapter. The Raspberry Pi's USB ports can supply a maximum of 1.2A (or up to 1.6A on Pi 5 with a 27W supply), which is insufficient to spin up high-draw mechanical hard drives.
  • File System Choice: Format your storage drive with ext4. While Samba can technically share NTFS or exFAT drives, native Linux file systems (ext4 or btrfs) provide dramatically better I/O performance, native POSIX file permissions, and file journaling that resists corruption during sudden power losses.

Format and prepare the external storage drive

Connect your USB drive to one of the blue USB 3.0 ports on your Raspberry Pi.

Identify your connected storage drive:

BASH
lsblk

Locate your drive identifier (typically /dev/sda). If the drive contains existing data you wish to clear, partition and format it with ext4:

BASH
sudo parted /dev/sda --script mklabel gpt mkpart primary ext4 0% 100%
sudo mkfs.ext4 -L "StorageDrive" /dev/sda1

Retrieve the unique UUID of your new partition:

BASH
sudo blkid /dev/sda1

Note the output string (e.g., UUID="a1b2c3d4-e5f6-7890-abcd-ef1234567890"). Using the UUID ensures your drive mounts to the exact same folder even if other USB devices are plugged in later.

Permanent mounting with /etc/fstab

Create a permanent mount directory:

BASH
sudo mkdir -p /mnt/nas-storage

Edit /etc/fstab to mount the drive automatically on boot:

BASH
sudo nano /etc/fstab

Append this mount configuration line (substituting your actual UUID):

TEXT
UUID=a1b2c3d4-e5f6-7890-abcd-ef1234567890 /mnt/nas-storage ext4 defaults,noatime,nofail 0 2

The parameters noatime eliminates unnecessary disk write operations on file reads, and nofail ensures your Raspberry Pi will complete its boot cycle even if the external drive is temporarily disconnected.

Mount the drive immediately without rebooting:

BASH
sudo mount -a
df -h /mnt/nas-storage

Create designated folders for shared data and configure system ownership:

BASH
sudo mkdir -p /mnt/nas-storage/shares/general
sudo mkdir -p /mnt/nas-storage/shares/timemachine

Install and configure Samba

Install the Samba software suite:

BASH
sudo apt update
sudo apt install -y samba samba-common-bin

Create dedicated Samba users

For security, do not expose your root administrative account over network shares. Create a dedicated user for file access:

BASH
sudo adduser --no-create-home --shell /usr/sbin/nologin nasuser
sudo smbpasswd -a nasuser

Set appropriate directory permissions for your shared directories:

BASH
sudo chown -R nasuser:nasuser /mnt/nas-storage/shares
sudo chmod -R 775 /mnt/nas-storage/shares

Craft an optimized smb.conf

Back up the original configuration file:

BASH
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak

Edit /etc/samba/smb.conf:

INI
[global]
   workgroup = WORKGROUP
   server string = Open Pi NAS
   security = user
   map to guest = Bad User
   log file = /var/log/samba/%m.log
   max log size = 1000
   
   # Performance and protocol tuning
   min protocol = SMB2
   ea support = yes
   vfs objects = catia fruit streams_xattr
   fruit:metadata = stream
   fruit:model = Macmini
   fruit:posix_rename = yes
   fruit:veto_appledouble = no
   fruit:wipe_intentionally_left_blank_rfork = yes
   fruit:delete_empty_adfiles = yes

[SharedFiles]
   path = /mnt/nas-storage/shares/general
   valid users = nasuser
   read only = no
   browsable = yes
   create mask = 0664
   directory mask = 0775

[TimeMachine]
   path = /mnt/nas-storage/shares/timemachine
   valid users = nasuser
   read only = no
   browsable = yes
   fruit:time machine = yes
   fruit:time machine max size = 500G

Test your configuration syntax:

BASH
testparm

Restart the Samba daemon to apply your changes:

BASH
sudo systemctl restart smbd nmbd

Connecting client devices

Connecting from macOS:

  1. In Finder, press Cmd + K (or click Go -> Connect to Server).
  2. Enter: smb://192.168.1.50 (or smb://raspberrypi.local).
  3. Enter username nasuser and the password created with smbpasswd.
  4. Select SharedFiles or choose TimeMachine in System Settings -> General -> Time Machine.

Connecting from Windows:

  1. Open File Explorer, click the address bar, and type \\192.168.1.50\SharedFiles.
  2. Check Remember my credentials, and log in with your nasuser account.
  3. Right-click the folder and select Map network drive to assign it a permanent drive letter (like Z:).

Connecting from iOS and Android:

  1. In the native iOS Files app, tap the ... menu -> Connect to Server, and enter smb://192.168.1.50.
  2. On Android, connect using solid file management apps (such as Material Files, Solid Explorer, or Cx File Explorer).

Automated backups with rsync

A single storage drive is not a backup. Hardware can fail, and disks can be dropped. Use an automated rsync script scheduled via cron to mirror your shared folder to a secondary drive:

BASH
rsync -av --delete /mnt/nas-storage/shares/general/ /mnt/backup-storage/general-backup/

Schedule this command to run nightly at 2:00 AM using crontab -e.

Monitor your NAS with Open Pi

Monitoring storage capacity and I/O bottlenecks prevents unexpected full-disk write errors.

With Open Pi on your phone: - Disk Utilization: Monitor partition space usage and inode availability in real time. - Disk I/O and Throughput: Check read/write transfer rates during intensive file transfers or Time Machine backups. - CPU & Thermal Status: Verify that Samba daemon encryption and multi-user transfers do not cause processor thermal throttling.

Troubleshooting common NAS problems

  • Permission Denied When Writing Files: Ensure the Samba user account has matching Linux POSIX permissions on the mounted directory. Verify ownership with ls -la /mnt/nas-storage/shares.
  • Sluggish File Transfers Over Wi-Fi: If network transfers are limited to ~5–10 MB/s, verify whether the client device is connecting over 2.4 GHz Wi-Fi instead of 5 GHz Wi-Fi. Always test NAS throughput using a wired gigabit Ethernet connection.
  • Drive Not Mounting on Boot: Check dmesg | grep -i usb and review /var/log/syslog. Ensure the drive is receiving adequate power and that the UUID in /etc/fstab matches blkid.

Sources and further reading

Open Pi logo
Monitor your Raspberry Pi from your phone

Check real-time CPU, RAM, temperature, and service health for your home server projects with Open Pi for iOS and Android. Local-first, private, and no cloud account required.

Explore Open Pi App StoreGoogle Play
About this guide

Researched and validated against official project documentation and community standards on September 11, 2026. Review your board model, storage, and current release notes before deploying.