Network-Attached Storage Built from Scratch
In this article I do a brief walk-through of a home-built Network-attached storage (NAS) device entitled ‘MaximusNAS’. You can think of it like an external hard-drive or HDD on steroids, like having your own private cloud. As opposed to an external drive, it sits on your network. Provided you have configured it correctly your NAS can be used to serve up files and folders as well as stream media. Playing music and movies is great but for my situation I opted to keep the usage limited to reading and writing files and folders.
There comes a time for every piece of networking gear to be refreshed and NAS are no exception. With technology constantly changing I found myself in need of a replacement solution to store files and folders on our network.
I settled on building my own device after toying with the idea of purchasing something off-the-shelf. Although there is no shortage of proprietary hardware and software when it comes to networked storage I wanted something where I could feel like I was a bit more in the driver’s seat. With this in mind I carefully considered several open source options for software. FreeNAS was my first choice but after closer inspection I discovered that it requires a decent chunk of hardware just to get your foot in the door. The second thing I picked up on was that it is based on FreeBSD and I am a Debian guy. People have managed to install Debian-based packages alonside FreeNAS but I felt like there were quite a few work-arounds needed. Since I was already using Ubuntu I wanted to stick with something that was more in my comfort zone: enter OpenMediaVault. It is Debian-based and appears to have excellent community support.
The following parts were used in MaximusNAS:
- AMD Ryzen 3 3200G 4-Core/4-Thread Processor
- Gigabyte B450 Aorus Elite V2 AMD
- Kingston A400 120GB SATA 3 Solid State Drive
- iCAN SATA 3 6GB/s Data Cable Straight-90Degree — 24″
- Seasonic Focus Plus Series SSR-550FX 550W 80+ Gold ATX12V
- Corsair CMK16GX4M2Z3200C16 Vengeance LPX 16GB (2 X 8GB) DDR4
- WD Red 4TB NAS Internal Hard Drive — 5400 RPM Class, 3.5″ (x4)
- Phanteks Eclipse P400A ATX Mid-Tower
- Phanteks Modular HDD Bracket Specific for Evolv ATX, Pro M Case (x4)
Confident I could forge ahead and begin building, I came up with a list of ‘must-haves’ and ‘should-haves’. The following are my requirements:
- Low cost, under $1,500 Canadian dollars.
- Automatic backups!
- Ability to swap hard-drives (HDDs) in event of failure.
- Health monitoring of HDDs including temperature.
- Filesystem compatible with Linux-based operating systems.
- Support for various redundant array of independent disks (RAID) levels.
- Iterative development, swappable hardware components that can be upgraded as well as reused in other projects in addition to ease of swapping one piece with another.
- Ability to mix and match different hardware including memory, processor, cables, enclosure, power and cooling.
- Lots of community support including stable and readily-available binaries.
- HHD(s) placed into standby when not in use.
- Graceful shut-down in event of power failure.
- Easily replaceable components that are available from multiple suppliers in Canada with an abundance of positive reviews on Amazon and other marketplaces.
- Replicable system builds for physical redundancy in multiple locations.
- Gigabit Ethernet.
- Minimum amount of McGuyvering to install and configure hardware along with a basic knowledge of electronics.
- Removable memory that can be flashed with a different OS to facilitate repurposing.
- Ultra-low ambient power, modest operating power.
- Low noise! MaximusNAS must not make people ask if we have any ear-plugs when they come for a visit.
And here is my list of desirable attributes for this project:
- Firewire module to connect my trusty Drobo.
- Hot-swappable HDDs.
- Equipment easily re-configurable, low-tooling needed to replace HDDs, easy swapping of components.
- Modular and customizable internal case layout as in 5.25-inch to 3.5-inch cage with cooling fans, tool-less 3.5-inch HDD caddies constructed of metal for optimum cooling.
- Movable parts (ie fans) built to withstand prolonged operating times.
- PWM-controlled fans each with independent settings.
- Remote management over internet.
- Link aggregation for improved through-put.
- Virtual stacking of multiple NAS for increased throughput.
- A wifi module capable of being turned off when not being used.
- The ability to clone/back-up to an external drive direct from the NAS.
- Facility for deploying Bash and Python scripts.
- Decent selection of Linux packages.
I had a few components ‘laying around’ that I hoped to re-purpose for this project. These included some old 2TB Western Digial ‘Caviar’ HDDs that I salvaged from one of my older NAS after it turned into a brick. I also had a keyboard, mouse and display to help get my new system up-and-running.
My first shipment of parts arrived on a Tuesday afternoon. Later that evening I managed to create a new partition on one of my old HDDs using the Disks utility in Ubuntu: things were looking up for the beginning portion of the project!
I ended up dropping the FireWire card in favour of leaving the Drobo connected to my Mac to serve as a secondary backup. Despite claims regarding compatibility with Linux, the
drobo-utils package appears out of date, at least on all of the websites I searched for it. My fear was that it was put up for grabs by a sole developer who has sinced moved on from the project. Unfortunately this left me with the sole option of keeping the Drobo connected to my Mac to allow for any firmware updates. The trickle-down effect also meant that the filesystem on the Drobo needed to be kept as HFS+ as opposed to the more-preferred Ext4. Without going into labourious detail, what I was really hoping for was a single filesystem type across all of my devices. During my tech refresh where I had to copy files from the old to the new system, the best I was able to muster was approximately 10MB/s from the Mac/Drobo combo when reading files. Once the new system is fully functional this rather slow through-put should not be a deal-breaker as long as I do not plan on making a massive amount of changes to my files in-between backups.
The build went together rather well, save for one side of the motherboard: there were no mounting holes along the side with the SATA connectors! What annoyed me more was the fact that the standoffs for the ATX mounting pattern butted up against the edge of the motherboard. You would think that they could have added a half-inch or so of PCB and drilled some holes to accomodate these attachment points. All this business led me to building a set of edge-mounted PCB standoffs. It also gave me a chance to tinker in my garage. People, I give you: Frankensaw.
Is it pretty? No. Functional? Sort of. But for fabricating slots in three small parts I think it works well enough. I happened to have enough spare bits and pieces kicking around that allowed me to whip up Frankensaw in a couple of minutes.
Combined with a piece of what I beleived was nylon from the edge of an old cutting board I had the raw material to fabricate a couple of PCB edge stand-offs. The result:
I had to remove the PCI slots and rear fan to move the motherboard far enough away from the existing standoffs in order to remove them. Nothing like an extra challenge in having to keep all of the cables connected!
Take care when removing the rear fan: the screws may strip the plastic housing, be careful when working with them.
Be careful when cutting nylon parts with a razor as they have a tendancy to crack in unexpected places. I found the best way to cut the parts was to gently rock the knife back-and-forth until enough of the material was cut before I could press gently downwards.
Keep any magnetic tools such as screwdrivers as far away from your HDDs as possible when working in and around your motherboard.
I used 6–32 machine screws and nuts although if you are considering this mod I recommend aquiring the metric version of these screws that mate with the case to save on having an extra-long fastener poke out the backside of the back-plane. Take care when installing the screws particularly if there are cables in the way. I took the precaution to protect my cables using nylon spiral-wrap.
For the case used in this build I recommend using 18-inch to 24-inch SATA cables with a right-angle end. Be sure to get some that have the cable pointing down when the HDDs are lying flat with their tops pointing up.
This was my first AMD build and I was fairly impressed once I had everything connected and was in the BIOS for the first time. Yes! There is an option to shut off all those motherboard LEDs.
While I did not go into any great detail on the build itself in this article I am interested to hear if any of you have similar experiences building a NAS of your own. How did it go for you?