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 (ext4orbtrfs) 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:
lsblk
Locate your drive identifier (typically /dev/sda). If the drive contains existing data you wish to clear, partition and format it with ext4:
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:
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:
sudo mkdir -p /mnt/nas-storage
Edit /etc/fstab to mount the drive automatically on boot:
sudo nano /etc/fstab
Append this mount configuration line (substituting your actual UUID):
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:
sudo mount -a
df -h /mnt/nas-storage
Create designated folders for shared data and configure system ownership:
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:
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:
sudo adduser --no-create-home --shell /usr/sbin/nologin nasuser
sudo smbpasswd -a nasuser
Set appropriate directory permissions for your shared directories:
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:
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
Edit /etc/samba/smb.conf:
[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:
testparm
Restart the Samba daemon to apply your changes:
sudo systemctl restart smbd nmbd
Connecting client devices
Connecting from macOS:
- In Finder, press Cmd + K (or click Go -> Connect to Server).
- Enter:
smb://192.168.1.50(orsmb://raspberrypi.local). - Enter username
nasuserand the password created withsmbpasswd. - Select
SharedFilesor chooseTimeMachinein System Settings -> General -> Time Machine.
Connecting from Windows:
- Open File Explorer, click the address bar, and type
\\192.168.1.50\SharedFiles. - Check Remember my credentials, and log in with your
nasuseraccount. - Right-click the folder and select Map network drive to assign it a permanent drive letter (like
Z:).
Connecting from iOS and Android:
- In the native iOS Files app, tap the ... menu -> Connect to Server, and enter
smb://192.168.1.50. - 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:
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 usband review/var/log/syslog. Ensure the drive is receiving adequate power and that the UUID in/etc/fstabmatchesblkid.
Sources and further reading
- Samba: Official Documentation and How-To Guides
- Raspberry Pi: Mounting External Storage
- Samba Wiki: Apple vfs_fruit Time Machine Setup
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.
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.