Almost as if it were a conspiracy between the creators of the USB specification and expensive retailers, sooner or later regardless the size of the network, some centralized and pluggable storage solution is required that cannot constitute just of USB drives.
Purchasing a Network Attached Storage (NAS) device is a nightmare in itself as well as reflective psychological plane when facing the realization that a NAS device is really just a standard and even reduce regular computer plus a SATA backplane such that you are effectively just paying for the benefit of the backplane rather than purchasing end-user gear.
Producers such as QNAP or Synology create end-user rack solutions that are massively overpriced and even relative to high end enterprise solutions such as rack enclosures that can be bought second-hand at a hundredth of the price of an end-user and commercial hardware whereas both are meant to more or less satisify the need for a centralized method of storing data.
So you heard that USB3+ is a fast standard that will measure up to Thunderbolt. That is great! Why not buy some cheap 1TB drives, connect them all to a nice USB hub, maybe even craft a nice DIY enclosure and then plug the USB hub into the computer and set up a RAID or a ZFS tank on top?
Unfortunately, this is not possible due to the controllers supplied with portable drives, in particularly controllers by Seagate but Western Digital having the same issues, being not that well supported by Linux (and hence the conspiracy allusion), such that under larger workloads, the controller ends up intermittently faulting and disrupting the RAID or ZFS tank.
That being said, there is essentially no solution and going the USB way, which seems very feasible given that the bus is supposed to support over 10GB/s, such that you are looking exclusively at purchasing some "solution" that has a communication bus, any other than USB. It is true that thunderbolt has not been tested but thunderbolt hard-drives are not that common and hence raise the price considerably such that it is arguable whether a homebrew thunderbolt solution would be feasible from an economical point of view.
The NAS solutions that you are expected to purchase (QNAP or Synology) are nothing more than "retro boards", featuring long-forgotten processors such as Intel Celeron, or processors from the era of the tulip fever of small laptops (the 11" kind) running various variations of Intel atom and even down to cheap Mediatek CPUs, but providing a SATA bus that at least guarantees that it will not be an experience as bad as USB.
The overpricing here is phenomenal, for a rack storage device by mainstream brands, counting up to 5 or 8 maximal drives, when contrasted to an enterprise storage solution based on SAS (but supporting SATA as well) drives, such as the HP StorageWorks bought second-hand from obsolete servers, the commercial surplus seems enormous.
We are looking here at spending USD100 to USD150 on obsolete but flawless HP enterprise storage that spans 5 * 5 drive bays, that is up to 25 drives, supporting both SAS and SATA drives and connecting via a direct SAS connection to machines that have a SAS controller and then comparing this solution to commercial NAS storage that reaches up to USD5000 or USD10000 for the equivalent service.
While retail NAS is extremely expensive, it is frequently justified by merchants due to their "additional" features, such as GPU acceleration, or TPMs and other gadgets and doohickies that are only secondary to the main purpose of a NAS.
Typically there are enclosures that just bunch drives together and then connect via USB to a computer, that have to be avoided due to the USB stability issues that will eventually end up with the same problems as a DIY chained hard-drives. Then, there are real NAS solutions that incorporate some PC motherboard, plus a SATA backplane allowing any operating system to be installed.
The general requirement that you would be looking for would be that the NAS solution you purchase will allow an easy way to install any operating system that you like onto the NAS solution itself.
Similarly, another thing to look out for, is that you will rather want an x86 architecture rather than an ARM or MIPS one, due to mainstream operating systems being available mostly on x86 (and even 64-bit x86) rather than other architectures. You do not want to end up with a NAS solution on ARM only to figure out that you can only install Android on it.
Fortunately, due to Chinese mass-production, there are NAS products available that are not that expensive comparatively to mainstream brands. For example, a "TerraMaster" NAS solution is relatively cheap compared to main brands, as well as being friendly enough to allow the user to plug in an USB stick and boot whatever operating system the CPU supports.
While TerraMaster was chosen for this tutorial, there are other similar cheap NAS solutions that come with the tradeoff of not being a well-known brand, not necessarily being built sturdy enough, or using inexpensive materials but with the actual functionality of a NAS being functional.
Opening up a TerraMaster F5-221 reveals a Celeron CPU board with a HDMI port, some USB3 ports (with one USB port being internal) as well as two Ethernet ports that will be used to connect the NAS to the network.
Moving on, interestingly the TerraMaster F5-221 has a RAM slot that can be used to expand the internal memory of the NAS. It seems that the total amount of RAM that can be addressed is 10GB such that the RAM slot can be filled with one RAM stick being 8GB large. Then the system will have 2GB that are embedded and 8GB expanded resulting in a total of 10GB of RAM - which, is mostly overkill for such a small system.
Given that the motherboard has one internal USB port, is is elegant to purchase a "nano uSB stick", of right-about any storage size and fit the stick inside the enclosure such that the NAS boots permanently to the installed operating system.
For TerraMaster systems, and most models such as F5-221, please be aware that there is just not enough clearance to use any USB stick and that the only USB stick that will fit inside the NAS enclosure is a "nano"-style USB stick as pictured.
Similarly, bear in mind that these PCs, also pertaining to BeeLink computers, are not exactly hammered out in terms of stability such that for TerraMaster specifically, it has been found that USB2.0 sticks do not work at all and will result in the system crawling to a half in case USB2.0 is used. Instead, TerraMaster NAS solutions require and USB3+ nano USB stick to work properly and anyone experiencing issues with software MAS solutions such as TrueNAS / FreeNAS or even Open Media Vault just need to change the USB stick to an USB stick that supports USB3.
As for populating your NAS with drives, another economic trick is to purchase consumer hard-drives that are sold inside a plastic enclosure and advertised as "portable storage" or "external hard-drive".
These drives are typically several notches cheaper than bare-bones HDD drives mostly due to mass-production and the fact that bare-bones HDD drives are considered specialty items whereas "portable storage" is directly targeting the end-user with a broad application range and an expected sales value exceeding that of specialty hardware.
When disassembled, these drives consist in just a plastic container and a SATA-to-USB small PCB that is plugged into the drive whilst exposing the USB port to be connected to a PC. Typically, the drive is opened by using a knife or a screw driver to lever up a plastic top that is fixed using plastic hinges to the box. The drive is wrapped up in aluminum, probably the reminiscent bad idea of a "heatsink" and can be easily disconnected from the SATA-to-USB board thereby leaving the bare-bones hard-drive to be plugged into the NAS.
While it is true that drives sold as portable storage, are definitely not enterprise level, when treated decently, these drives can go on working for up to a decade without too much trouble just with the drawback that they are not meant to be too fast. Ultimately, the speed does not matter much and filesystems such as ZFS allow using NVME to speed up the drives, by using an intermediary temporary storage and an intelligent way to commit to long-term storage using the SATA drives.
Be aware that the former is mostly applicable to Seagate branded drives and that there have been instances where a Western Digital "portable storage" drive has been disassembled only to find the SATA-to-USB pcb soldered directly onto the drive thereby not allowing users to remove the PCB and use the hard-drive as a bare-bones drive.
There are several solutions available out there that can be used as a NAS operating system (even though, if the architecture is x86, it is feasible to convert the NAS enclosure to a Microsoft Windows Server solution as well):
One thesis is that unless you have a varying degree of knowledge or if you do not want to mess about too much then the software solutions that are ready-made and meant to run a NAS enclosure such as TrueNAS or OMV are sufficient. However, if you are an advanced user, you have to realize that sooner or later you will be starting to look up things such as "how do to enable jumbo frames in TrueNAS?", or "how to do interface bonding in TrueNAS?", or "how do I run a torrent client directly on TrueNAS", such that sooner or later it will be more sensible to have installed a mainstream Linux operating system onto the NAS device rather than going with NAS-centric solutions where the various levers and knobs are withheld from the user or delivered as "plugins", "addons" or even worse, "hacks".
Similarly, some of these popular solutions run on operating systems that have fallen into obscurity, such as BSD, that has built its own nice, carved out of the Linux niche and presents itself today as "not Linux". Even though BSD claims itself to be stable mainly due to package selection, it lacks in terms of right about any stack (networking, bluetooth) or others, while the same buggy software that is present in Linux distributions is percolated into BSD out of necessity. Finally, either due to being "conservative" or not, BSD lacks in terms of hardware support, as any other operating system would lack when there are few discrete updates. Linux and the Linux community is a superset that has gone long strides to support a very diverse selection of hardware, even the obscure and cheap kind, such that flaunting to run FreeBSD is really just a statement on being a "not Linux"-user. Then again, the same problems will appear sooner or later, along the lines of "how do I mirror the Ethernet port" and other questions that are solved by a 2 minute iptables rule but would take compiling or re-compiling kernel modules for FreeBSD.
The bottom-line? FreeBSD in its quest to be "not Linux" has limited support for "ext" filesystems such that after you went through the whole ordeal of modifying the hardware, have a beer in hand and want to transfer over your terabytes of data onto your cool FreeBSD powered NAS, knowing that it will be a short ride given that USB3 is "fast", you will be psychologically damaged noticing that TrueNAS / FreeBSD having limited support for Linux "ext" filesystems. Then you will end up booting into a Linux live CD just to copy over your data onto the drives that should be managed by FreeBSD - quite the computational gymnastics for something as easy as copying data from A to B and all of that knowing that FreeBSD just tries to be "not Linux", especially since "ext" is open-source allowing BSD to create a kernel-level driver and just add support.
Ultimately, remember that you really bought this overpriced thing for the SATA backplane, and nothing much else, such that there is no reason for the NAS enclosure to run anything else than what you are used to. If you are knowledgeable in theory there is no reason to run anything other than what you're used to know to be stable. In the ultimate case where you desperately need a user-interface, Webmin can be installed that will provide you with more boxes to tick and fields to complete than necessary.
As part of post-modernism, encryption is mandatory and not an option anymore, such that a filesystem with support for encryption should be preferred. Fortunately, ZFS has been ported from Unix to Linux and ZFS now is directly supported by an in-kernel module, instead of just being supported over FUSE. All things considered, the choice is between:
mdadm
, that is, the generic Linux RAID tools,and out of all of them the most stable and widely supported one seems to be ZFS. For TrueNAS, ZFS is the default operating mode that is used to combine the individual drives that are plugged in to the NAS. Now that Linux has ZFS support, ZFS can be installed on distributions such as Debian-based distributions via DKMS, meaning that the ZFS kernel module will be recompiled every time the kernel is upgraded automatically without having to worry about compatibility during updates.
ZFS can be set to read an encryption key from a file:
zfs set keyfile=file:///etc/zfs/storage.key TANK
where:
TANK
is a ZFS tank
and the key-file can be read from storage once the NAS boots up by creating a SystemD file at /etc/systemd/system/zfs-load-key@.service
with the following contents:
[Unit] Description=Load ZFS keys DefaultDependencies=no Before=zfs-mount.service After=zfs-import.target Requires=zfs-import.target [Service] Type=oneshot RemainAfterExit=yes ExecStart=/sbin/zfs load-key %I [Install] WantedBy=zfs-mount.service
Given the matching key-file set with the zfs
command as /etc/zfs/storage.key
, then the service file can be enabled using the name of the ZFS tank, in this particular case, named storage
:
systemctl enable zfs-load-key@storage.service
where:
storage
is the name of the TANKsuch that the key file will be read on boot before the ZFS filesystems are mounted.
Ideally, the key would be stored within a TPM that matches the hardware to the disk-drives such that the disk-drives cannot be decrypted unless the hardware configuration matches.
To summarize, here is a guide, containing some opinions and some facts:
ext
filesystem reliably such that if you need to transfer data between your old Linux drive and TrueNAS you are outright out of luck; typically the solution is to boot in a Linux live ISO that supports both ZFS and the ext
filesystem and perform the transfer in Linux,