title: Building my own NAS description: FreeNAS / TrueNAS based x86 server parent: projects date: 2018-03-01 update: 2022-06-05
With growing storage needs I sooner or later had to build a proper NAS. Before that, I was using mutliple 4TB disks in my desktop to store stuff like music, movie, photo and tv-series collections, backed-up to a wild assortment of plain 3.5” HDDs put into a USB-SATA bay.
To have a centralised place for all these files, as well as for running server software like a media library with live transcoding, I decided to go with FreeNAS / TrueNAS, based on FreeBSD.
This is what the result looks like, currently living on a shelf in my storage room.
And these are the parts I went with.
Luckily I was able to buy the case, power supply, CPU cooler and tape drive as a used set from a friend of mine for a good price. To be honest, because of the issues mentioned below, I haven’t yet gotten around to installing the cooler I got from him. Currently I’m still using the stock Intel cooler that was included with the Celeron.
Just for completeness sake I also got an uninterruptible power supply for the NAS. Of course I connected them via USB and run a daemon that shuts down the server when the UPS battery reaches a critical state. I also connected an old VGA LCD to the NAS and the UPS, as well as USB keyboard, to be able to interact with the server if needed.
As you can see from the parts list, there was some trouble with the CPU I selected initially. This was caused by a misunderstanding of mine in regards to the mainboard. Turns out the C236 can not boot without a graphics adapter available, probably because of the UEFI. It has an option available to configure the UEFI via a serial port, but this still requires some kind of graphics output to work. The Intel Xeon I had did not have any kind of integrated graphics, so the system simply was not booting at all.
To get going, I then bought the cheapest option I could find that would fit the requirements, a Celeron G3900 for only 35€. This one has Intel HD Graphics 510 included and still supports ECC memory. I sold the Xeon on eBay to someone in Italy without significant loss. I initially went with the beefier Xeon for running VMs and transcoding media streams, but it turns out the Celeron seems to be more than powerful enough for my needs, at least for now.
To have a “proper” NAS I of course decided to go with ECC RAM to avoid any data corruption in RAM. To at least somewhat match the size of my array, I went with 32GB.
With multi-TB drives in use currently, considering their mean time between bit failures, a higher level of redundancy is really required. Otherwise, when a drive dies and all data needs to be re-read when resilvering the RAID array, the probability of hitting another failure is relatively high. For this reason I decided to go with RaidZ-2, so two drives for redundancy, allowing two drives to die and the data still be readable.
Looking at my storage requirements at the time of starting this project and considering some healthy rate of growth, I decided to go with five 10TB disks, resulting in 50TB raw space and about 30TB of usable space after redundancy.
In June 2022, about four years after starting this project, I’ve now used up 16TB, so I think this was a good decision compared to 5x8TB or even 5x4TB.
The Lian-Li PC TU 200 case I selected only fits 4 hard disks by default. But thanks to its modular nature, I was easily able to design a 3D printed mount for a fifth disk.
One thing I’m not quite happy with is the airflow inside the case. The front fits a 140mm fan that directly hits the disks. Nonetheless the temperature of the disks is just below 50°C, which is a bit high for my liking. Sometime in the future, I want to replace the case with a full-size ATX one with easier accessible drive bays and more space for fans and cable routing.
The screenshots above also show the average CPU usage, which shows the Celeron is plenty enough for now. The power usage is reported by the UPS via USB. Blank spots in the third graph are caused by the data-polling daemon running on my desktop PC, which is turned off at night. The spike at the end of the month in all three graphs is caused by the monthly ZFS scrub. To collect this data I’m using InfluxDB and Telegraf.
As you can see from the parts list above, I also got an LTO-3 tape drive with the case I bought used. I kinda got into this idea thanks to my friend Philipp, who also uses a tape drive like this to backup his NAS. He even put the scripts he wrote for that on GitHub.
I have to admit however that I still haven’t gotten around to actually implementing that. The drive is connected using a PCIexpress SCSI HBA and is properly recognized by the OS, but I haven’t used it otherwise.
Installing and configuring TrueNAS (still called FreeNAS at the time I was setting it up) is pretty straight-forward. Download the ISO, take a close look at the official documentation and follow it!
Besides a Debian VM configured for my IoT needs using my Ansible scripts, I run a Rancher instance for Docker containers, which currently only runs a PiHole productively, besides being used for some experiments here and there. I’m also using the great TrueNAS plugin system to run a local Plex and Nextcloud, although I’m not quite satisfied with these parts of my setup. But they do the job for now.
Both the C236 as well as my desktop PC have two 1Gbit/s Ethernet NICs. So I decided to get a Netgear GS308T Managed Switch and attempt to use link aggregation to achieve faster connection speeds and actually be able to saturate my RAID.
Unfortunately I haven’t been able to get it to work at all. I configured both the FreeBSD in TrueNAS as well as my Arch Linux desktop as described on the net, but the result was my whole home network completely breaking down in strange ways. WiFi devices could no longer connect outside through the router, even though the router wasn’t involved at all in the aggregate links.
In the end I have to admit I’ve given up. To be honest, I don’t really need the faster speeds. But if anyone has suggestions, I’m open to try it again!
Recently I was greeted by this log message in the TrueNAS web UI.
Device: /dev/ada5, 584 Currently unreadable (pending) sectors
Device: /dev/ada5, 584 Offline uncorrectable sectors
Taking a look at the ZFS pool status, some read errors cropped up on two (!) drives already. Guess I should have made sure not to get drives from a single batch 🤷
Unfortunately hard disk prices are still high and I’m currently not able to afford two new drives. So for now I’m making sure I have a working backup and hope for the best 😅