Project Ares: Part III - OS and file system considerations
Sharing the experience of building a home NAS/VM server.
The 3rd part discusses the operating and file system of the new server, the requirements and the available alternatives.
Now that the hardware is ready, the next quest is to choose The Right Operating System™ to be installed onto the server. This decision has some important implications and consequences, as it might not be entirely easy to switch the OS afterwards. Not that it is totally impossible, however once everything is set up and configured, we could find ourselves very hesitant to switch to a completely different system, especially when we don’t know the new system well yet, whether or not it will have any issues e.g. with the HW and support everything what’s needed, and in addition have to reconfigure everything again. Such step might also include the need of data migration (if the new system doesn’t support the current file system setup).
It is eventually also possible to try to setup a dual-boot system, however it is a bit tedious to begin with (as we’d be basically setting up everything and looking for the solutions twice, not even mentioning setting up the boot loader properly so that it can boot both systems), only to find out later that we anyway ended up with using just the first of the systems and even afraid to boot the other one as it is heavily outdated after not booting it up for the whole last year.
1. The requirements
The planned usage also implies some requirements on the operating system features and capabilities, some of which are essential, others nice to have.
- File system:
- RAID support: RAID-1 (mirror) for the system disk, RAID-5/6 for data
- flexibility in adding the drives to the disk pool RAID (especially for the data drives)
- encryption support (ideally including root/boot partition)
- large volume support
- data safety
- thin provisioning support or equivalent to allow re-distribution of the free space
- SSD support (TRIM etc.)
- nice to have: snapshots, error detection/correction
- Network sharing:
- essential: Windows sharing (CIFS/samba)
- nice to have: other sharing options like NFS, (S)FTP etc.
- Virtualization:
- running virtual machines of different systems (Linux, Windows, Solaris, eventually Mac OSX)
- allocation of resources to particular VMs (memory, CPU cores, virtual disks, …), HW pass-through
- nice to have: Docker support
- Hardware friendly:
- support of all hardware used currently or eventually in the future
- Remote administration:
- being able to be managed remotely over the network
- nice to have: administrative GUI
- Performance:
- the OS itself should take as less resources as possible
- disk access performance
- good performance of the hosted virtual machines
- network card link aggregation support
- Flexibility:
- possibility to perform advanced tasks, like getting the root partition encryption key from the USB / network during booting etc.
- nice to have: choice in using different file system formats, encryption solution providers etc.
2. The available options
There are 3 principal options (categories) of the operating systems that can be used here:
2.1. Regular operating systems
This category includes any non-specific server or desktop systems that include various Linux distributions (Ubuntu, RHEL/CentOS, OpenSUSE, …) or Windows (desktop/server).
Option | Advantages | Limitations |
---|---|---|
Globally |
|
|
|
|
|
|
|
|
Other Linux distributions |
|
|
Windows (Server / Desktop) |
|
|
2.2. NAS specific operating systems
Here we can have a look onto various NAS dedicated systems 1 2 that usually provide nice administrative GUIs (generally via web interface). Most of these are Linux or FreeBSD based.
Option | Advantages | Limitations |
---|---|---|
Globally |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Other NAS distributions |
|
|
2.3. Virtualization platforms
Bare metal hypervisors used to launch other systems in the virtualized environment. Popular options are KVM, Xen, ESXi, Hyper-V.
Although this category might be beneficial for the planned usage as a virtual machine platform, I didn’t evaluate this option in detail as I currently don’t have much experience in this area and for what I know they can be quite difficult to install and maintain (and use properly) - at least as the “bare metal” option (also taking into account that I’m setting up a single server in a home environment, for a business running multiple servers the requirements and the decision may be very different).
One nice example is also Proxmox, which can serve as a virtualization platform (using KVM+QEMU on top of a Debian base system) or the ESOS project.
3. The operating system chosen
After carefully evaluating all the options, I decided to use a Linux server distribution, mainly because of the flexibility they provide. The NAS-dedicated solutions like FreeNAS offer a very nice administrative interface and are thus easier to setup and maintain, but it might be difficult to achieve some advanced scenarios (like root file system encryption, they have RAID layout and file system choice limitations etc.).
On the other side, such decision implies more work setting up and maintaining the system, changing the configuration etc. - so if you are not a “geeky geek” wanting to control each and every aspect of the system and just want “something that works” (and works pretty well actually), I would definitely recommend choosing one of the NAS dedicated system like FreeNAS (would be my preferred choice) or OpenMediaVault. They have a very nice interface, plugin systems etc. and are very user friendly.
To be honest, I must admit that I actually have a strong bias towards the “regular” Linux distributions for 2 main reasons:
- I already have a good amount of experience running (another) NAS machine using the Ubuntu Server (that is over 10 years old and still running, although it will be decommissioned once this project is complete)
- and I don’t currently have much experience with the NAS dedicated systems (except for the other QNAP NAS box, where I find the QTS interface pretty nice and user friendly, but indeed limited in some aspects)
3.1. The distribution chosen
So after I made the decision to use a Linux distribution, now the question was which one to choose. I have some experience with both Ubuntu and CentOS, my old NAS box uses Ubuntu but the CentOS is even more “server oriented” and designed for stability, so both choices have their merits.
To see which one will fit better, I actually tried to install both (even in a dual boot configuration initially, but as I also wanted to use ZFS, I found out that they somewhat clash if used within the same ZFS pool, despite being installed onto different datasets). In particular, I was testing these versions:
- Ubuntu Legacy Server 20.04 LTS (the pure Server version without GUI)
- CentOS 8.2.2004 Minimal Server
As you can notice, I tend to install the minimal server versions (without the GUI first, as the server will be managed remotely over the SSH anyway, although later on I might install some kind of GUI in minimal configuration for eventual VNC access).
During testing of both of the systems I realized that for the requirements I wanted to achieve (boot/root on ZFS in RAID-1, encrypted root) the CentOS has various limitations that make it a bit harder to use in such configuration:
- does support ZFS, but not for the boot partition (in particular, the boot partition can’t even be part of LVM, or at least the installer doesn’t support it) - it might eventually be possible to do it somehow (as the Grub boot loader should support ZFS), but it doesn’t work out of the box (whereas it works in the Ubuntu)
- puts the Grub menu configuration directly onto the EFI partition (which makes it tedious to mirror as it is updated after each Grub change e.g. after any kernel update) - Ubuntu only puts a “link” file on the EFI that never changes afterwards
- it doesn’t (directly) support the HBA LSI-2008 card (the one I use for the data disks) out of the box, as the SAS-2 drivers (mpt2sas) were removed in the RHEL / CentOS 8 - it is still possible to side-load them via the El-Repo repository, however it is a bit tedious (especially if it needs to boot from there, although that is not required for my use-case), and it is also a sign that this hardware might not be supported that well in the future in this distribution - whereas the Ubuntu still supports it out of the box
So after this testing and evaluation, the winner is:
Ubuntu Legacy Server 20.04 LTS
4. The file system layout
The operating system choice affects the available choices of the file system features and layout. The Ubuntu Linux distribution selected actually offers one of the most wide range of possible choices, but of course there are still some limits.
The following tables show the various possibilities and features available.
4.1. File system format
Candidate | Advantages | Limitations |
---|---|---|
Ext3 / Ext4 |
|
|
XFS 5 |
|
|
BtrFS 5 |
|
|
ZFS |
|
|
4.2. Volume management
Candidate | Advantages | Limitations |
---|---|---|
Raw partitions |
|
|
LVM |
|
|
ZFS |
|
|
4.3. RAID solution
Candidate | Advantages | Limitations |
---|---|---|
No RAID |
|
|
MD RAID (SW) |
|
|
LVM RAID (SW) |
|
|
ZFS RAID (SW) |
|
|
UnRAID (SW) |
|
|
Hardware RAID |
|
|
4.4. Encryption
Candidate | Advantages | Limitations |
---|---|---|
LUKS |
|
|
TrueCrypt / VeraCrypt |
|
|
ZFS native encryption |
|
|
Hardware encryption |
|
|
4.5. What others use
Let’s check what file systems the well-known NAS device manufacturers use:
- QNAP: Ext4: The preferred file system (with their own proprietary block-based snapshot technology)
- Synology: How Btrfs protects your company’s data
- TerraMaster: BtrFS
- Netgear: older ReadyNAS devices vere using Ext2/3, newer support BtrFS
5. The file system layout decisions
Considering the above options, I’ve picked the following options:
5.1. The system disk
- 2 disks, mirrored on the partition level (no full-disk encryption)
- GPT partition table (large drive support, automatic backup)
- EFI System Partition:
- raw GPT partition
- no RAID - copied to other drives manually once complete
(RAID-ing the EFI is possible with MD RAID and metadata 1.0, but creates some issues with OS installers etc.)
- boot partition:
- ZFS, separate pool (limited features neede for Grub to boot)
- no encryption (would always need to provide password for Grub)
- ZFS mirror (mirroring works fine in ZFS)
- root/home partitions:
- LUKS encrypted partition on each mirror drive
- ZFS (full features) over the LUKS layer
(poor performance of the ZFS native encryption + can’t encrypt root anyway) - ZFS-level mirror over the LUKS partitions
- no thin provisioning needed
5.2. The data disks
- 4 x 8 TB via the HBA adapter (+ various 1-2 TB disks from the old NAS box once decommissioned)
- GPT partitioning
- single GPT partition over the each whole drive
- RAID-5 configuration with Linux mdraid (ZFS raidz doesn’t allow to extend the array) on the partition level (not physical disk level 14)
- single LUKS or Truecrypt/Veracrypt (not decided yet) layer over the whole mdraid (poor performance of the ZFS encryption 12)
- ZFS over the encryption layer
- no thin provisioning needed (data sets share the whole space anyway)
Note that this setup also has some downsides, in particular not using the native ZFS RAID (for the data drives) and encryption but using ZFS on top of other layers somewhat nullifies the ZFS safety, error detection and recovery (there may be errors happening upstream that the ZFS cannot detect and/or repair).
It has some performance implications as well - the ZFS-level RAID would be able to synchronize/rebuild the array on the file system level (i.e. knows which data are in use and only copies those), whereas the MD RAID working on the block level doesn’t have that knowledge and must therefore (re)sync the whole drive(s).
6. Next steps
Stay tuned for the next part, where I will get into the details of installing the chosen OS, in particular onto an encrypted ZFS root partition in the RAID-1 mode.
Resources and references
-
8 Free NAS Storage OS / Software For Small Business Enterprise ↩
-
FreeBSD vs. Linux Scaling Up To 128 Threads With The AMD Ryzen Threadripper 3990X ↩
-
DragonFlyBSD vs. FreeBSD vs. Ubuntu 20.04 On Intel’s Core i9 10900K Comet Lake ↩
-
What’s the Difference Between Linux EXT, XFS, and BTRFS Filesystems ↩ ↩2
-
Encrypted dataset still slow and high load with ZoL 0.8.3 ↩ ↩2
-
Flaws in Popular SSD Drives Bypass Hardware Disk Encryption ↩
-
What’s the difference between creating mdadm array using partitions or the whole disks directly ↩
Leave a comment