Considering the sheer number of NAS-centric distributions out there, choosing the right operating system for your storage server can seem rather tiresome. After all, unless you’re willing to wipe everything and start from scratch, you’ll be stuck with the distro once you’ve initialized the data pools. Modern NAS operating systems tend to ship with tons of packages and extra facilities to simplify your file transfer, backup, and data archival workloads.

But what if you just want a no-nonsense NAS configuration – one that only features your favorite services? While there are a handful of simple distros out there, nothing beats the sheer flexibility of a custom NAS OS. Since I’ve cycled between most of the popular server-oriented operating systems out there, I figured I could try to set up an ultra-light NAS configuration – and it turned out to be a piece of cake!

Choosing a distro for the custom NAS

Ubuntu Server, I choose you!

Before I could go about installing packages, I had to select the OS that would serve as the base of my NAS. I was a bit tempted to go with FreeBSD, but figured Linux distros would give me fewer headaches. GUI distributions were out of the question, not only because they ship with additional apps, but also because I had no use for icons when I planned to configure everything from the terminal.

Debian was my first choice, though I’ve heard about some edge-case scenarios where the DKMS module has broken ZFS pools. But since Ubuntu ships with ZFS modules and only needs a few packages to manage Zpools, I decided to roll with it instead. To be more specific, I went with the Ubuntu Server version of the distro. Installing Ubuntu Server was a cakewalk thanks to its simple setup wizard, and the only change I made was enabling OpenSSH. That way, I could access the NAS from my primary system without spending more time configuring an SSH service.

Setting up the ZFS pools

My data hoarder instincts forced me to pick ZFS

Although ZFS is infamous for its high memory utilization and lack of flexibility, it’s my favorite file system by a long shot. Its Copy-on-Write facility is great for preserving data integrity, while checksumming can detect (and sometimes, even repair) data corruptions, but one can argue that Btrfs also includes these features to some extent. However, ZFS’ RAID prowess is by far the best of any file system I’ve used, and it’s the main reason why I wanted to use ZFS instead of configuring Btrfs pools.

Since Ubuntu already supports ZFS, I could simply install zfsutils-linux using the sudo apt zfsutils-linux -y command. I wanted to go for a mirrored (RAID 1) configuration for my hard drives, so I executed sudo zfs pool create mypool mirror sdb sdc, where sdb and sdc were the names of my drives. After that, I ran the zpool status command, which confirmed that the pools were successfully created.

Creating a network share

SMB is perfect for my needs

With the ZFS pool online, I had to configure a network share to allow my LAN devices to store data on it. Although NFS can have better performance, I prefer the simple nature of the SMB protocol – especially when it comes to permission management.

So, I ran sudo apt install samba smbclient -y to install the packages for SMB shares. Then, I created a new directory for it by executing mkdir /mypool/myshare. The /etc/samba/smb.conf is responsible for managing SMB connections, though I had to run sudo chmod 777 /etc/samba/smb.conf to get full write access to this config file. I scrolled down to the bottom of the file and pasted the following code snippet to link the directory I’d created earlier to the SMB share as well as grant write privileges to the root user.

path = /zfs_pool_name/share_name
read only = no
valid user = user_name
writeable = yes

For security-conscious folks following along, you might want to create another user and grant access privileges to it by running these commands:

useradd -m user_name
passwd user_name
smbpasswd -a user_name

Once I’d set up the smb.conf file, I ran the systemctl restart smbd.service command. Just to confirm whether everything worked, I switched to the File Explorer on my PC, typed // followed by the NAS server’s address, and entered the user credentials to access the share. And voilà, my storage server was operating perfectly fine.

Configuring additional NAS packages

Rsync and smartmontools are handy for a NAS

Technically, my NAS setup was already complete, though it was rather barebones at the moment. For starters, I had no way of checking the drive statistics, and that’s a huge problem for a storage server. As such, I installed the Smartmontools package with the sudo apt install smartmontools command. But since I wanted to schedule these scans, I opened the /etc/smartd.conf file using the nano editor and edit the line DEVICESCAN -s (S/../.././22|L/../../0/00). That way, my NAS runs short S.M.A.R.T. tests at 10 pm every night, with a long test scheduled for 12 am every Monday.

Since I’m a firm believer in 3-2-1 backups, I installed the rsync utility using the sudo apt install rsync command. For now, I’ve set it to create manual backups on a local NAS, but I plan to install Tailscale on this node, connect it with a remote storage server, and deploy a cron job to schedule jobs.

But they're not the only useful tools

Aside from Rsync and SmartMonTools, I’ve got a couple of NAS-centric tools I’ve used in the past that make sense for the DIY storage server. NFS shares, for example, are undoubtedly better for Linux systems, especially where performance takes precedence over all else. Likewise, I’ve got a few iSCSI shares running on my primary NAS, and I plan to do something similar with this ultra-light storage setup.

I’m probably going to avoid arming this system with containers, but if you’ve got a NAS with decent specs, some containerized services can go a long way in improving your server’s utility. You can also throw in a management UI (like Cockpit) to manage your Docker/Podman-based containers. But at that point, I’d suggest ditching my DIY storage server idea and going for a plugin-heavy OpenMediaVault setup instead of configuring everything by yourself.