Building a NAS: part 1
For a long time my backup strategy has roughly followed the strategy suggested by Jamie Zawinski. For the most part this has been great, and there are certainly times when I've been glad I've had a backup! However managing files across multiple devices and keeping them in sync has always been slightly awkward. Previously I also used TrueCrypt to encrypt by backups, however this is no longer supported.
To fix this I'm planning to build a DIY NAS so I can sort and backup my files.
Ideally I would like to achieve the following:
Snapshots: create regular snapshots so I can quickly restore deleted files if required.
Mirroring: all data should be mirrored to a second disk so data can survive a single disk failure.
Run headless: I'm planning to keep the NAS in the cupboard under the stairs, so I want to be able to control it remotely (e.g. over SSH) without needing a monitor attached.
Encryption: use full disk encryption to protect the confidentiality of data stored on the NAS.
Cost: to keep costs down the NAS should be low power, and ideally reuse existing hardware I have access to.
Backups: backup data to external drives, ideally automatically when a backup drive is attached.
I'm planning to use the following hardware for the NAS:
HP MicroServer G7 (N54L): my brother kindly gave me his old HP MicroServer. The AMD CPU (AMD Turion™II Neo N54L (2.2GHz)) is pretty dated by modern standards; however the system uses just under 50W at idle and should be enough for a basic NAS.
40GB SSD: I'm planning to repurpose an old SSD to install the operating system on. This should hopefully be more reliable than installing onto a USB drive.
4TB HDDs: I currently have two 4TB hard drives which will be used to hold my data. Depending on how quickly my snapshots grow I might look to upgrade these in the future.
External drives: I have several external drives to use for backups. My only concern is the lack of USB 3.0 on the MicroServer will limit transfer speeds significantly.
When it comes to building a DIY NAS, FreeNAS is one of the first operating systems that comes to mind. While FreeNAS would be a fairly good fit, I'm more familiar with Linux, and will likely use the NAS to host other services (e.g. a Radicale calendar).
I'm also keen to avoid having to regularly re-install the OS, this narrowed my choice of distros down to distros with long support windows like Debian or CentOS.
One of my goals is to set up regular automatic snapshots. While this can be done in software, using a copy on write filesystem is in my opinion a more elegant solution. There are two well used copy on write filesystems available for Linux, ZFS and Btrfs.
In theory Btrfs would be fine for my use case, however I'm slightly concerned for its future given Red Hat recently dropped support for it in RHEL 8. ZFS has been around for nearly 15 years now, and while there are some legal complications, this hasn't stopped Ubuntu shipping ZFS since 16.04.
To protect my data at rest I want to use full disk encryption on both the OS disk, and on the data disks. For the OS disk, I'm planning to use LUKS; however for the data disks, ZFS actually supports native encryption. Unfortunately this feature isn't available in the current long term support (LTS) release of Ubuntu (18.04). Thankfully the next LTS release of Ubuntu (20.04 Focal Fossa) is just a few days away.
If everything goes well, the next part in this series will go through setting up Ubuntu 20.04 on the MicroServer.