Disclosure: some links on this page are affiliate links. If you sign up through them we may earn a commission at no extra cost to you. It helps keep LinuxDistroFinder free.
A home NAS lets every device on your network — laptops, phones, smart TVs, game consoles — access a central pool of storage without plugging in a USB drive. Commercial NAS boxes from Synology or QNAP are convenient but expensive: a decent 2-bay Synology starts at around $300 before you even add drives. A spare PC or even a Raspberry Pi 5 running Linux can do the same job for a fraction of that cost, with far more flexibility.
This guide walks you through the entire linux nas setup guide: choosing hardware, picking a distro, formatting and mounting drives, setting up Samba shares for Windows and macOS clients, NFS shares for Linux clients, basic RAID with mdadm, and optional extras like a web UI and remote access.
What Hardware Do You Actually Need?
Almost any x86-64 machine with two or more SATA ports works. You do not need a powerful CPU — a NAS spends most of its time idle, waiting for a read or write request. The bottleneck is almost always the network (1 Gbps Ethernet is ~125 MB/s) or the drives themselves, not the processor.
| Hardware | Min. Spec | Recommended | Notes |
|---|---|---|---|
| CPU | Any dual-core (2010+) | Intel Celeron J4125 / N100 | Low TDP crucial for 24/7 use |
| RAM | 2 GB | 4–8 GB | ZFS needs ≥8 GB; ext4/Samba fine at 2 GB |
| Boot drive | 16 GB USB / SSD | 60–120 GB SSD | Keep OS separate from data drives |
| Data drives | 1× HDD (any size) | 2×+ HDD for redundancy | Use NAS-rated drives (WD Red, Seagate IronWolf) |
| Network | 100 Mbps Ethernet | Gigabit Ethernet | Wi-Fi not recommended for a NAS |
| Power | Any PSU | Efficient PSU (80+ Bronze) | Idle draw matters at 8,760 hrs/year |
Choosing Your Linux NAS Distro
You have two broad paths: a dedicated NAS distro with a web UI baked in, or a general-purpose server distro where you configure everything yourself. Both are completely valid.
Debian-based, uses OpenZFS natively, and ships with a polished web UI covering storage pools, SMB/NFS/iSCSI shares, Docker apps, and more. If you want a NAS that "just works" with a GUI and you have ≥8 GB of RAM (ZFS loves RAM for its ARC cache), TrueNAS SCALE is hard to beat. It is 100% free and open-source. The minimum recommended RAM is 8 GB but 16 GB is comfortable for a home setup with a few Docker apps running alongside.
Also Debian-based, OMV is far lighter than TrueNAS SCALE — it runs happily on 1–2 GB of RAM, making it perfect for a Raspberry Pi 4/5 or an old Atom-based mini PC. The web UI covers Samba, NFS, FTP, S.M.A.R.T. monitoring, and RAID. Extra functionality (Docker, ZFS) comes through community plugins called OMV-Extras. OMV 7 (current as of 2026) is based on Debian 12 Bookworm.
If you want full control — specific kernel, custom Samba config, scripted everything — a plain Ubuntu Server 24.04 LTS or Debian 12 install is excellent. No GUI overhead, long support window (Ubuntu LTS gets 5 years standard, 10 with ESM), and every package you could want is available. This is what the rest of this guide primarily demonstrates.
Based on openSUSE Leap, Rockstor uses BTRFS as its primary filesystem and offers a clean web UI with snapshot scheduling built in. Good choice if you prefer BTRFS over ZFS and want a managed interface. Less popular than OMV or TrueNAS so community resources are thinner.
Step 1 — Install Ubuntu Server and Update
Download Ubuntu Server 24.04 LTS, flash it to a USB drive with Balena Etcher or dd, boot your NAS machine from it, and follow the installer. During setup: enable OpenSSH server, skip Docker for now, and install to your dedicated OS SSD (not your data drives). Once you have a shell (either directly or via SSH), run:
# Update package lists and upgrade all packages
sudo apt update && sudo apt full-upgrade -y
# Install essential utilities
sudo apt install -y htop lsblk smartmontools hdparm curl wgetStep 2 — Identify and Prepare Your Data Drives
Plug in your data drives and identify them. Drive names (sdb, sdc, etc.) can change between reboots if you use them directly — always use stable identifiers by UUID or disk ID when mounting.
# List all block devices with sizes and mount points
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT,MODEL
# Get UUID and filesystem info for all drives
sudo blkid
# Check drive health with SMART
sudo smartctl -a /dev/sdbPartitioning a Single Drive (no RAID)
If you are starting with a single drive and no redundancy (acceptable for a first setup where you back up to cloud), create one large partition and format it as ext4:
# WARNING: this destroys all data on /dev/sdb — confirm the correct device first
sudo parted /dev/sdb --script mklabel gpt
sudo parted /dev/sdb --script mkpart primary ext4 0% 100%
# Format as ext4 with a label
sudo mkfs.ext4 -L nasdata /dev/sdb1
# Create mount point and mount
sudo mkdir -p /mnt/nasdata
sudo mount /dev/sdb1 /mnt/nasdataAdding to /etc/fstab for Persistent Mounts
# Get the UUID of your new partition
sudo blkid /dev/sdb1
# Add a line like this to /etc/fstab (replace UUID with your actual value)
echo 'UUID=a1b2c3d4-e5f6-7890-abcd-ef1234567890 /mnt/nasdata ext4 defaults,nofail 0 2' | sudo tee -a /etc/fstab
# Test that fstab is correct before rebooting
sudo mount -anofail option is important — without it, a missing or failed drive will cause your system to drop to emergency mode on boot instead of continuing normally.Step 3 — Set Up Software RAID with mdadm (Optional but Recommended)
If you have two or more data drives, RAID 1 (mirroring) is the simplest way to protect against a single drive failure. With two 4 TB drives in RAID 1 you get 4 TB of usable space that survives one drive dying without data loss. Note: RAID is not a backup — it does not protect against accidental deletion, ransomware, or fire.
# Install mdadm
sudo apt install -y mdadm
# Create a RAID 1 array from /dev/sdb and /dev/sdc
# Both drives should be raw (no existing partitions)
sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb /dev/sdc
# Watch the initial sync progress (takes hours for large drives)
cat /proc/mdstat
# Format the RAID array
sudo mkfs.ext4 -L nasraid /dev/md0
# Mount it
sudo mkdir -p /mnt/nasdata
sudo mount /dev/md0 /mnt/nasdata
# Save the mdadm configuration so it survives reboots
sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf
sudo update-initramfs -u
# Add to fstab by UUID (get UUID first with: sudo blkid /dev/md0)
echo 'UUID=YOUR_MD0_UUID /mnt/nasdata ext4 defaults,nofail 0 2' | sudo tee -a /etc/fstabStep 4 — Create Share Directories and Set Permissions
# Create top-level share folders
sudo mkdir -p /mnt/nasdata/{media,documents,backups,public}
# Create a dedicated NAS group and add your user
sudo groupadd nasusers
sudo usermod -aG nasusers $USER
# Set group ownership and permissions on share folders
sudo chown -R root:nasusers /mnt/nasdata
sudo chmod -R 2775 /mnt/nasdata
# The public folder is world-readable
sudo chmod 2777 /mnt/nasdata/publicStep 5 — Set Up Samba (Windows / macOS File Sharing)
Samba implements the SMB protocol, which is the native file-sharing protocol for Windows and is also understood natively by macOS Finder and most Android/iOS file manager apps.
# Install Samba
sudo apt install -y samba samba-common-bin
# Back up the default config
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
# Open the config for editing
sudo nano /etc/samba/smb.confReplace the contents of smb.conf (or add to the end of the [global] section and append share definitions) with something like the following. The [global] section configures server-wide behaviour; each bracketed section after that is a share:
[global]
workgroup = WORKGROUP
server string = Home NAS
netbios name = homenas
security = user
map to guest = bad user
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
server min protocol = SMB2
[media]
path = /mnt/nasdata/media
valid users = @nasusers
read only = no
browsable = yes
create mask = 0664
directory mask = 2775
[documents]
path = /mnt/nasdata/documents
valid users = @nasusers
read only = no
browsable = yes
create mask = 0660
directory mask = 2770
[public]
path = /mnt/nasdata/public
guest ok = yes
read only = no
browsable = yes
create mask = 0666
directory mask = 0777# Test the config for syntax errors
testparm
# Create a Samba password for your Linux user
sudo smbpasswd -a $USER
sudo smbpasswd -e $USER
# Restart and enable Samba
sudo systemctl restart smbd nmbd
sudo systemctl enable smbd nmbd
# Allow Samba through UFW firewall
sudo ufw allow sambaOn Windows, open File Explorer and type \\homenas (or \\) in the address bar. On macOS, press Cmd+K in Finder and enter smb://homenas.
Step 6 — Set Up NFS (Linux-to-Linux File Sharing)
NFS is faster than Samba on Linux-to-Linux transfers and has lower overhead. If your clients are all Linux machines, NFS is the better choice. You can run both Samba and NFS simultaneously.
# Install NFS server
sudo apt install -y nfs-kernel-server
# Edit the exports file
sudo nano /etc/exports# Add lines like these — replace 192.168.1.0/24 with your subnet
/mnt/nasdata/media 192.168.1.0/24(rw,sync,no_subtree_check,no_root_squash)
/mnt/nasdata/documents 192.168.1.0/24(rw,sync,no_subtree_check,root_squash)
/mnt/nasdata/public 192.168.1.0/24(rw,sync,no_subtree_check,all_squash)# Apply exports and restart NFS
sudo exportfs -rav
sudo systemctl restart nfs-kernel-server
sudo systemctl enable nfs-kernel-server
# Allow NFS through UFW
sudo ufw allow from 192.168.1.0/24 to any port nfsOn a Linux client, mount an NFS share like this:
# On the client machine — install NFS client utilities
sudo apt install -y nfs-common
# Mount the media share temporarily
sudo mount 192.168.1.100:/mnt/nasdata/media /media/nas-media
# For a permanent mount, add to /etc/fstab on the client
echo '192.168.1.100:/mnt/nasdata/media /media/nas-media nfs defaults,nofail,_netdev 0 0' | sudo tee -a /etc/fstabStep 7 — Monitor Drive Health Automatically
Hard drives fail silently. S.M.A.R.T. monitoring via smartd emails you before a drive dies.
# Enable smartd and configure it to email on errors
sudo systemctl enable --now smartd
# Edit the smartd config
sudo nano /etc/smartd.conf# Add this line for each drive (replace /dev/sdb and email)
/dev/sdb -a -o on -S on -s (S/../.././02|L/../../6/03) -m your@email.com -M exec /usr/share/smartmontools/smartd-runnersudo smartctl -t short /dev/sdb to kick off a short self-test, then sudo smartctl -a /dev/sdb five minutes later to see results. Do this for every drive when you first set them up.Optional: Install OpenMediaVault on Top (Web UI)
If you installed Ubuntu Server and want a web UI without switching distros, you can install the OMV management panel on top of a fresh Debian 12 install (OMV officially supports Debian only, not Ubuntu). Alternatively, consider Cockpit — a lightweight, official Red Hat web console that works on Ubuntu and Debian and gives you a browser-based dashboard for storage, services, and system health with no extra distro required.
# Install Cockpit on Ubuntu 24.04
sudo apt install -y cockpit
sudo systemctl enable --now cockpit.socket
# Allow through firewall
sudo ufw allow 9090/tcpThen open https:// in a browser and log in with your Linux username and password. The Cockpit storage module gives you a visual overview of drives, RAID arrays, and mount points.
Want Cloud Storage Alongside Your Home NAS?
A home NAS covers local redundancy, but off-site backup matters too. Spin up a cheap VPS to run rsync, Nextcloud, or Duplicati for encrypted cloud backups of your most critical data. Vultr's $6/month instances give you plenty of headroom.
Get $100 Free Credit on Vultr →Or try Hostinger VPS — affordable plans starting from $4.99/month, great for a remote Nextcloud or backup target.
Step 8 — Remote Access (Optional but Useful)
Accessing your NAS from outside your home network requires either port-forwarding (not recommended without a VPN) or a proper VPN tunnel. The safest and simplest option in 2026 is Tailscale, a WireGuard-based mesh VPN that requires no port-forwarding and works through CGNAT.
# Install Tailscale on the NAS
curl -fsSL https://tailscale.com/install.sh | sh
# Authenticate and bring the NAS online
sudo tailscale up
# Install Tailscale on your phone/laptop, then connect —
# your NAS will appear at its Tailscale IP (e.g. 100.x.x.x)
# and you can mount SMB/NFS shares over the VPN tunnelQuick Comparison: Samba vs NFS vs iSCSI
| Protocol | Best For | Speed | Auth | OS Support |
|---|---|---|---|---|
| Samba (SMB3) | Mixed OS homes | Good | Username/password | Windows, macOS, Linux, Android, iOS |
| NFS v4 | Linux-to-Linux | Excellent | IP-based / Kerberos | Linux, macOS (limited), BSD |
| iSCSI | Block-level (VMs, DBs) | Excellent | CHAP | Linux, Windows, VMware |
| FTP/SFTP | File transfers only | Moderate | Username/password | Universal |
Frequently Asked Questions
Do I need ECC RAM for a home Linux NAS?
ECC (Error-Correcting Code) RAM is strongly recommended if you plan to use ZFS, because ZFS relies on in-memory data integrity. OpenZFS documentation explicitly warns against using ZFS on non-ECC RAM for important data. For ext4 or BTRFS with Samba/NFS, standard RAM is fine for home use — the risk of a RAM-caused corruption is real but low enough that most home builders skip ECC and accept the trade-off.
How much RAM does TrueNAS SCALE need?
TrueNAS SCALE requires a minimum of 8 GB RAM to install, and recommends 16 GB for comfortable use with a few apps. ZFS uses RAM for its Adaptive Replacement Cache (ARC) — the more RAM you give it, the better read performance you get. A general rule of thumb is 1 GB of RAM per 1 TB of raw storage, though this is conservative and most home setups work fine with 8–16 GB regardless of drive count.
Is RAID 1 good enough for a home NAS?
RAID 1 (mirroring) is excellent for protecting against a single drive failure. With two drives, one dying does not mean data loss — you replace the failed drive and the array rebuilds. However, RAID is not a substitute for backups. If both drives fail simultaneously (power surge, controller issue), or if you accidentally delete a file, RAID does not help you. Follow the 3-2-1 rule: 3 copies, 2 different media types, 1 off-site.
Can I use a Raspberry Pi 5 as a NAS?
Yes, and it works well with OpenMediaVault. A Pi 5 with USB 3.0 drives or a HAT with SATA ports can sustain 100–200 MB/s read speeds over Gigabit Ethernet, which is more than enough for most home streaming and backup workloads. The Pi 5 idles at about 3–5 W, making it very cheap to run 24/7. The main limitation is USB bandwidth — avoid connecting more than two large drives over USB without a powered hub.
What is the difference between OpenMediaVault and TrueNAS SCALE?
OpenMediaVault is lighter (runs on 1 GB RAM), Debian-based, and uses traditional filesystems (ext4, BTRFS, XFS) by default. TrueNAS SCALE is more feature-rich out of the box, uses ZFS natively with enterprise-grade data integrity features, and has better support for virtualisation and containers — but needs at least 8 GB RAM. For a Pi or an old Atom mini PC, choose OMV. For a proper small server with 8+ GB RAM, TrueNAS SCALE is arguably the better long-term choice.
How do I access my NAS from my iPhone or Android phone?
On Android, file manager apps like Solid Explorer, FX File Explorer, or MiXplorer support SMB and NFS shares directly. On iPhone, the built-in Files app supports SMB (tap the three dots menu → Connect to Server and enter smb://your-nas-ip). For remote access from outside your home network, install Tailscale on both your phone and the NAS — it creates a secure VPN tunnel automatically.