At the start of this year I built a Network-Attached Storage (NAS) server to store backups, photos & videos, digitised VHS tapes, cached builds, and more. Having a dedicated machine has allowed me to use it in ways that wouldn't be feasible with cloud storage, such as live transcoding of media playback to different resolutions or codecs, and having it physically co-located makes it resilient to network outages. I had a look at some of the pre-built solutions out there, but they seemed expensive for what they were, often having architectures a few generations behind. So I decided to build my own. With the price of energy in the UK power efficiency was a primary concern and informed many of the decisions made when building it.

The N100 CPU, while designed for mobile, looked very attractive due to its low 6W Thermal Design Power (TDP) whilst supporting hardware transcoding with an integrated GPU. The Asrock N100M motherboard uses this chip and gives us 2x SATA3 and 1x M.2 ports, with the possibility of expanding this with e.g. ASMedia 1166 PCIe Gen3 x2 to 6x SATA3. Due to the low TDP of the chip it also uses passive (fanless) cooling. I also looked at the Topton N100 motherboard (and other chips they offer) as recommend by some blogs, but various forum posts and blogs reported issues with performance and sleep states due to the in-built JMB585 PCIe SATA controller. I got the Asrock N100M along with 16GB compatible RAM. As I didn't opt for ECC memory I ran memtest from the BIOS a few times to give me some confidence.

I bought the Corsair CX550 to handle power spikes that might result from booting if I want to scale this up to 10+ drives, whilst also purportedly being power efficient at the lower end of the draw/efficiency curve.

I got two 16TB Hard Disk Drives for the NAS to run in RAID 1 (mirroring) with ZFS. I went for two large hard drives in RAID 1 for simple recovery and power efficiency. The greater the number of drives the greater the power draw (~4W per drive). SSDs would have been quieter and more power efficiency, but they are significantly more expensive than HDDs especially for this size.

$ zpool create tank mirror /dev/disk1 /dev/disk2

The majority of the time the drives are not active. There's a trade-off here between hard drive wear in spin-ups, and power efficiency, but at the moment I've got them configured to spin down after 1 hour of idling, using hdparm.

$ hdparm -S 242 /dev/disk

I have a 1TB M.2 SSD to run the OS from, some trivial storage like git repositories that I don't need a lot of space or redundancy for, as well as a ZFS level 2 adaptive replacement cache (L2ARC).

$ truncate -s 512G /var/zfs_cache
$ zpool add poolname cache /var/zfs_cache

Like most of my machines I'm running NixOS on my NAS for declarative management of system configuration. The configuration can be found here. While getting hardware transcoding working with Intel's QuickSync I ended up contributing to fixing it on NixOS.

I'm running a number of storage-heavy services including Jellyfin, a Sambda file server, Nextcloud, and Restic. This machine isn't exposed to the Internet at the moment, only being accessible over Wireguard VPN. If it were exposed I could move a number of service currently running on a small cloud VPS to the NAS including a nameserver, matrix server, mastodon server, webserver serving a number of websites, and a mailserver (perhaps utilizing sendgrid for mail deliverable from a residential IP).

I'm using Restic to backup various machines to this NAS. As RAID is not a backup, I'm also using Backblaze to store ~100GB of precious data for pennies a month.

I took some non-exhaustive power measurements, using a power meter plug, while tinkering:

All in all the hardware for this NAS, excluding the cost of the hard disk drives, was:

Which is competitive with off the shelf solutions out there. You could reduce this further by opting for a cheaper case or smaller SSD.

Assuming an idle power draw of 12W running 24/7 we would use 12W * (365*24)=105kWh in a year. With a price of 22.36p/kWh this costs ~£23 per year to run. We could possibly reduce this by taking advantages of cheaper electricity during the night that some providers offer in scheduling energy-intensive tasks, like backups. Another possibility that I'm toying with is when the NAS is idling for long periods putting it into a hibernation, which should idle at 1 or 2 Watts. To wake the NAS up, we could send a Wake-on-LAN (WoL) packet from a nameserver running on the local router on a DNS resolution for the NAS' name.