01 January 2020
Building a Network Attached Storage (NAS)
For years, I stored all my personal data on a single hard disk without backups. Despite the fact that I never had a disk crash at that point, I realised how prone I was to data loss due to disk failure, so I upgraded to two redundant disks that mirror the data. For that, I used a Windows Software RAID1 with a mirrored NTFS partition. Within two years, my first disk failed and I was very glad to be able to just replace the broken hard disk and resync the disk array. No data was lost. However, I was feeling really uneasy during the resyncing process, knowing that this is the last working drive with all my personal data. After that incident, I decided to also have offline backups in the form of a USB hard drive that I synchronise every few months. Going back to that version would be inconvenient but not catastrophic. This way, my data is also safe from accidental deletion or ransomware, though the main risk I want to mitigate is hardware failure because it is much more likely. Ideally, this external drive is stored in a different building to avoid losing the data in a fire or a similar catastrophe.
The Windows RAID1 served me well, but there were a variety of significant drawbacks.
1. Whenever Windows crashed or my PC froze, the entire 3TB RAID array had to resync after I started my PC again. This was my main desktop computer on which I worked and played video games, so while crashes weren't regular, they were unavoidable from time to time. Reading and writing 3TB on 5200RPM disks took half a day to a day. The resync process obviously maxed out the disk throughput, so there were performance implications. In addition to that, during that time, the RAID1 partition was vulnerable: What happens if a disk fails during the resyncing process? Is my data still safely stored on both disks? In general, the resyncing process was very opaque and the Windows Disk Manager sometimes just refused to display the sync progress percentage. The resync process started over at 0% whenever the system was rebooted. Back when the PC was in my bedroom, that was a big problem because I do not like fan and HDD noises at night when I want to sleep. I could not power down my PC because I wanted the resync process to finish. In addition to that, Windows updates, in particular the frequent Windows 10 updates, mercilessly rebooted the PC over and over while I wasn't using the PC, making the resync processes take many days because it had to start over so many times. Clearly, RAID1 wasn't getting any love from Microsoft and the Updater didn't care about it at all.
2. I want to tinker with my machine, install various programs, hard reset it when problems occur, and so on. The fact that all my data was inside this machine in this fragile RAID1 made me uncomfortable with both software and hardware experiments. I had to be more careful and felt restricted.
3. The Windows RAID1 causes significant vendor lock-in with Microsoft. If for some reason Windows no longer works and you quickly boot into a Linux rescue image, it is hard to mount the Windows RAID1 NTFS partition. Frankly, I never seriously attempted it because I did not want to risk destroying the partition by making a mistake in this nonstandard procedure. I read some StackExchange posts and it seems to be possible, but it is also often advised against. Because Windows refuses to be installed on USB sticks and needs to be licensed, rescue is much more tedious than it needs to be.
4. The Windows RAID1 on NTFS became really slow. Now, I'm not sure if that was due to fragmentation or perhaps due to folders that contain thousands of files. Or maybe a Windows patch or new feature slowed things down. Windows is not exactly know for fast file operations. Either way, it became unacceptably slow. Opening folders, displaying thumbnails and looking at photos was riddled with inexplicable delays that could last for seconds (this reflects my general experience with Windows 10 across many computers, but I won't go into that in this post). I didn't track down the root cause of the issue because I'm done with Windows RAID1, so maybe the slowness is caused by a mistake of my own making.
5. The data is not available on my other computers. This has nothing to do with Windows or software RAID, but I'd like my other devices like my notebook to be able to access my data without first turning on my power hungry Desktop PC.
So I started to look for NAS devices and the final contenders were from Synology and QNAP. However, when I looked at the prices compared to the features these devices deliver, I was very disappointed. In particular, I was surprised and disappointed to learn that on a Synology NAS, you cannot simply install any Linux distro you want. That is completely unacceptable. If I'm moving away from Windows RAID, the last thing I want is more proprietary software, breaking updates and locked down platforms. I don't want a simple file server to dictate my digital life. The QNAP NAS devices seem to allow the installation of another operating system and overall, they made a good impression, so it would have been my final choice. However, their devices did not satisfy all my needs and it's fun to put together a PC with components, so that's what I did.
I have a variety of requirements for a NAS device, a lot of which are not provided by off-the-shelf systems:
- Dust filters
- Quiet
- HDDs dampened with rubber rings or pads for noise reduction
- HDD rack with at least drawers if not hotplug bay
- CPU with fast encryption
- ECC memory at least 4GB if not 8GB
- Low power usage
- The more SATA ports, the merrier
- PCI-e lanes are an advantage
- Is modular, repairable and possibly expandable
- Free choice of file system and encryption scheme
- Software works in transparent ways, data recovery possible through Linux rescue stick
- Allows me to install any OS and software, I am in full control of the updates
Let me explain some of these points in more detail.
Computers are essentially vacuum cleaners that happen to calculate at times. Seriously, if you do not have dust filters, the fins of your coolers and the surface mounted components on your motherboard will act as a dust filter. Over time, this leads to bad air flow and overheating and thus decreased hardware lifespan. Dust filters are not optional! A NAS device is always on, usually for years at a time. No matter how clean you keep the room, dust will accumulate. Some dust always gets into the computer, even with dust filters, so I vacuum my computers regularly. It does wonders for hardware longevity, even if you just do it a few times per year. Note: Always turn off and unplug your PC while you're vacuuming. Make sure you avoid getting too close to the circuitry. Electrostatic discharge, especially from plastic vacuum cleaner nozzles, is a real thing. I once vacuumed my PC while it was running and a static discharge caused the PC to crash. Luckily it still worked afterwards.
The NAS device is in my office, so I want to minimise noise. Rubber rings are an essential part of noise management for magnetic hard disks. The entire computer case should ideally have some noise isolation, e.g. by being built sturdily and having padding inside. Fans should have high quality bearings with a long life. Because dust can get lodged inside the fan bearings and cause eccentric motion and accelerated wear, it is crucial to manage dust accumulation as discussed above. It's hard to even get a sense of who uses high quality bearings and who doesn't. Over the years, you will learn whose fans start screeching and whose stay silent. If you buy an Intel processor, throw that worthless fan that comes with it right into the trash and buy a proper one. Intel CPU fans are some of the worst fans known to man. I've made good experiences with Seasonic power supplies and MSI graphics cards. I cannot recommend Gigabyte graphics cards from a noise perspective. But my sample size is very small. Often, the review comments (e.g. on Amazon) reveal noise issues if you dig deep enough.
The HDDs should be easy to change in case of a disk failure. I don't really need to hotplug them, but HDD drawers are really convenient. I don't want to take my entire PC apart to switch a hard disk. The removal of a broken disk should be doable just by opening one side panel, unplugging the power and SATA plug and sliding the HDD out. If it takes any more than that, that's too much.
I want ECC memory to minimise the error rate in data handling. When you push Gigabytes or Terabytes through your computer, the probability of an error suddenly becomes greater than expected. A binary file with a flipped bit in its code section is often rendered useless. I'm not sure how big an issue this is. I have never noticed a bitflip during data handling in my life, though with ordinary RAM, seeing the occasional error in a Memtest is not uncommon. I want 4-8GB of RAM just to make sure that the system always has enough resources and in case I want to use the device as a build server.
And lastly, I want to set up open and free software that I control and does not control me, that is free from forced telemetry and automatic updates and that is rock solid. The only way to achieve this in today's world is to install a popular Linux or BSD distribution and file system.
In early 2018, I ordered the following components (with the exception of the WD Red hard drives, I already had those, and I ordered the SSD a bit later):
Case | 1x | Fractal Define Mini (Micro Tower) | |
Motherboard | 1x | ASUS P10S-I (LGA 1151, Intel C232, Mini ITX) | |
CPU | 1x | Intel Core I3-6100 (LGA 1151, 3.70GHz) | |
CPU fan | 1x | Scythe Shuriken Rev. B (6.40cm) | |
Thermal paste | 1x | Arctic Silver 5 (3.50g, 9W/m K) | |
PSU | 1x | Seasonic Focus Plus 550 Gold (550W) | |
RAM | 1x | Kingston Value RAM (1x, 8GB, DDR4-2133, DIMM 288) | |
HDD | 2x | WD Red (3TB, 3.5") | |
HDD Cable | 1x | Adaptec Mini-SAS HD x4 (SFF-8643) to 4 Serial ATA x1 | |
SSD | 1x | Sandisk SSD Plus (120GB, 2.5") |
The components fit together well and within a few hours, I had Linux up and running. The hard part is selecting the components, if that's done carefully, then putting it together is easy.
The computer uses 21-22W when it's idle or lightly used (e.g. if a single music file is played off the NAS) and can use up to 65W when it's under load (e.g. program installation, compilation, system update). While the idle value is roughly double that of smaller off-the-shelf NAS devices, I think that is a very acceptable value for a comparably very powerful NAS device. The PSU is a bit overdimensioned with its 550W, but I know that this PSU is great and that's why I got it anyway. The computer has 6 SATA ports (if the Mini-SAS adapter cable is used), two Ethernet ports, a 16x PCI-e lane, an M.2 slot, two USB 3.0 ports and a 3.7GHz dual core processor. The case has dust filters, noise padding and 6 HDD drawers, currently I only need three. Without the two WD Red 3TB HDDs, it cost about 700 Swiss Francs (1 Swiss Franc is roughly equal to 1 USD). Interestingly enough, most components would now be more expensive than they were back then.
This concludes the discussion about the hardware side of the NAS. After the build was finished, I installed the system to my needs and transferred my data. If I've got time, I will explain in a future post how to set up the software side of things, in particular, how to set up, manage and rescue RAID1 disks, how to create an encrypted volume and how to share data in the home network with Samba. Not that this information cannot be found on the internet, but most guides lack details or explanations or simply contain wrong information that potentially puts all your data at risk. They simply aren't written with the care and attention to detail that is needed to guide someone through the process smoothly.
Unfortunately, this blog post was delayed all the way to the year 2020 due to how busy I've been. However, this allows me to write about how well the NAS has been running, and I'm happy to say that in the months that it's been running 24/7, there wasn't a single problem. And despite the data now going over Gigabit Ethernet, file browsing has become much faster (I chose ext4 for the file system). Accessing the files both on Linux and Windows is simple and convenient. Overall, I'm very happy with this solution.
Post comment
Comments
(no comments yet)