Guide · Storage · ~15 min read
How to build a DIY NAS at home (beginner-friendly)
A Network Attached Storage box is just a small computer on your home network that shares folders to your PCs, TVs, and phones — usually filled with hard drives. You can buy a ready-made Synology or QNAP, or build your own for less money and more flexibility. This guide walks through drives, RAID types, TrueNAS vs plain Ubuntu, and the bash commands you need on a Linux path.
What is a NAS, really?
Think of it as a always-on file server in a closet. You copy movies, backups, and photos to it over Wi‑Fi or Ethernet. Unlike an external USB drive plugged into one PC, everyone on the LAN can reach it. A DIY NAS is typically an old desktop, a mini PC, or a small server board with several internal hard drives and a simple operating system focused on storage.
What you need (hardware checklist)
- Computer — old PC, Intel N100 mini PC, or server; 8 GB RAM is a comfortable minimum for ZFS; 16 GB+ if you run VMs or many Docker containers.
- Drives — 3.5″ NAS or enterprise HDDs for bulk storage (8 TB+ is common in 2025–2026 builds); add SSDs only if you need fast apps or caching.
- Enough SATA ports or a HBA — onboard motherboard ports work for 4–6 drives; beyond that, a used LSI SAS HBA in IT mode is the hobbyist standard.
- Boot drive — small SSD or USB stick separate from your data disks so you can replace data drives without reinstalling the OS.
- Network — gigabit Ethernet at minimum; 2.5 GbE or 10 GbE helps if you edit large files over the network.
- UPS (optional but wise) — clean shutdown during power cuts protects RAID arrays mid-write.
RAID types explained (without the jargon trap)
RAID is not a backup. It protects you from one failed disk in the array, not from ransomware, accidental deletes, or your house flooding. You still want backups (another NAS, cloud, or cold spare drive off-site).
Manufacturers quote RAID levels with numbers. Here is what home builders actually choose:
| Name | Also called | In plain English | Good for | Watch out |
|---|---|---|---|---|
| JBOD | Just a Bunch Of Disks | No redundancy — one drive per folder or merged volume. | Maximum capacity, simple setup | Any failure loses that drive’s data |
| RAID 1 | Mirror | Two (or more) identical copies of the same data. | Survives one drive failure (in a 2-drive mirror) | Uses 50% of raw capacity |
| RAID 5 | Striped + parity | Data spread across 3+ drives with one parity block. | Good balance of space and safety for home NAS | Rebuilds are slow; risky if another drive dies during rebuild |
| RAID 6 | Double parity | Like RAID 5 but tolerates two drive failures. | Safer for large arrays (6+ drives) | More capacity overhead than RAID 5 |
| RAID 10 | Mirror + stripe | Pairs of mirrors, then striped (needs 4+ drives, even count). | Fast reads/writes, survives one failure per mirror pair | Expensive in drives — 50% capacity loss |
| ZFS mirror | ZFS (not classic RAID) | Two drives hold the same data; managed by ZFS (TrueNAS default). | Checksumming catches silent bit rot; easy in TrueNAS | Needs ZFS-aware OS (TrueNAS, Ubuntu + ZFS tools) |
| ZFS RAIDZ1 | ZFS RAID-5 equivalent | Single parity across 3+ drives. | Flexible snapshots & scrubbing | Use ECC RAM if possible; learn ZFS basics first |
TrueNAS vs plain Ubuntu — which should you pick?
Both are valid. The choice is really “appliance vs general-purpose Linux.”
TrueNAS SCALE (or TrueNAS Core)
- Web UI for almost everything — create pools, shares, users without daily bash.
- ZFS built in: snapshots, scrubbing, and checksums are first-class.
- SCALE is Debian-based and runs Docker/Kubernetes apps; Core is FreeBSD-based and very mature for pure file serving.
- Great if you want a Synology-like experience on your own hardware.
- Less ideal if you want the machine to also be a desktop, game server, or exotic custom kernel playground.
Plain Ubuntu Server (or Debian)
- Full Linux — install Samba, Plex, Docker, VPN, whatever you want with apt.
- You choose filesystem tools: classic
mdadm+ ext4/XFS, or install OpenZFS and use zpool like TrueNAS. - More reading up front, but maximum control and transferable Linux skills.
- You are responsible for updates, security patches, and configuring disks correctly.
| TrueNAS | Ubuntu Server | |
|---|---|---|
| Best for | Set-and-forget file server | Tinkerers & multi-purpose homelab |
| RAID / pools | ZFS via GUI | mdadm, ZFS, or mergerfs — your call |
| Learning curve | Lower | Higher |
| Apps | Official apps + Docker (SCALE) | Anything in the Linux ecosystem |
| CLI | Optional | Required for setup & fixes |
Path A — TrueNAS in brief
- Download TrueNAS SCALE from the official site and write the installer to a USB stick (Balena Etcher or dd).
- Boot the NAS PC from USB; install TrueNAS onto your boot SSD, not your data drives.
- In the web UI (https:// your-nas-ip), use Storage → Create pool and pick Mirror (2 drives) or RAIDZ1 (3+ drives).
- Create a dataset (e.g.
pool/home), then Shares → SMB for Windows/macOS access. - Schedule a scrub monthly and enable email/Discord alerts for failed drives.
No bash required for day-to-day use — that is the point.
Path B — Ubuntu Server with bash (mdadm + ext4)
Below assumes Ubuntu Server 24.04 LTS, three empty data disks (/dev/sdb, /dev/sdc, /dev/sdd), and a RAID 5 array. Replace device names with yours. The install will destroy data on those disks.
1. See what the system detects
lsblk -o NAME,SIZE,TYPE,FSTYPE,MODEL,MOUNTPOINT
Unmounted disks you plan to use show no MOUNTPOINT. Note exact names — mixing them up is painful.
2. Install RAID tools
sudo apt update
sudo apt install -y mdadm
3. Create a RAID 5 array (example)
# Creates /dev/md0 from three drives — confirm names first!
sudo mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sdb /dev/sdc /dev/sdd
Answer prompts; the installer may ask about updating /etc/mdadm/mdadm.conf — say yes.
4. Check array status
cat /proc/mdstat
sudo mdadm --detail /dev/md0
5. Format and mount
sudo mkfs.ext4 -L nas-data /dev/md0
sudo mkdir -p /mnt/nas
sudo mount /dev/md0 /mnt/nas
df -h /mnt/nas
6. Auto-mount after reboot
# Get the RAID UUID
sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf
sudo update-initramfs -u
echo '/dev/md0 /mnt/nas ext4 defaults,nofail 0 2' | sudo tee -a /etc/fstab
sudo mount -a
7. Share folders with Samba (Windows / macOS)
sudo apt install -y samba
sudo mkdir -p /mnt/nas/shared
sudo chown -R $USER:$USER /mnt/nas/shared
Add a share block to /etc/samba/smb.conf:
[shared]
path = /mnt/nas/shared
browseable = yes
read only = no
guest ok = no
valid users = your_linux_username
sudo smbpasswd -a your_linux_username
sudo systemctl restart smbd
From Windows: \\nas-ip\shared — from macOS: Finder → Go → Connect to Server → smb://nas-ip/shared.
Optional — ZFS on Ubuntu (TrueNAS-like pools)
If you want checksums and snapshots on Ubuntu:
sudo apt install -y zfsutils-linux
# Mirror (RAID 1) example with two drives:
sudo zpool create tank mirror /dev/sdb /dev/sdc
sudo zfs create tank/media
sudo zfs set compression=lz4 tank/media
zfs list
Point Samba at /tank/media instead of /mnt/nas. Use zpool status and zpool scrub tank for health checks.
Replacing a failed drive (mdadm)
# Mark failed (if not already):
sudo mdadm /dev/md0 --fail /dev/sdb
sudo mdadm /dev/md0 --remove /dev/sdb
# After physically swapping the drive:
sudo mdadm /dev/md0 --add /dev/sdb
cat /proc/mdstat # watch resync
Security & habits worth adopting
- Static IP or DHCP reservation so clients always find the NAS.
- Separate admin password from your Wi‑Fi password; disable guest SMB access.
- Run
sudo apt update && sudo apt upgrademonthly on Ubuntu. - Snapshot (ZFS) or backup to a USB drive you unplug and store elsewhere.
- Test a restore — a backup you have never restored is a guess.
Summary
Pick drives that match your capacity and budget (NAS-rated HDDs, 8 TB+ for multi-bay builds), choose RAID 1 / RAIDZ1 / RAID 5 for redundancy, and decide whether you want TrueNAS’s GUI or Ubuntu’s flexibility. RAID keeps the server running when a disk dies; backups keep your files safe when you delete the wrong folder or get hit by malware.
When you are ready to buy disks, compare prices on hwprice — start with the NAS build quick pick.
Comments
Questions, corrections, or your own NAS build notes? Join the discussion below.
Loading comments…