Custom RAID NAS with Raspberry Pi2020-02-28 | Permalink
Edit: WARNING Do not follow the advice in this post. Do not get the X725.
Recently, my old NAS system died on me, and I was in the market for something else. The only thing I use it for is backups, so I don’t really need much in terms of fancy NAS features like seamless streaming and a web-interfaces.
One thing that had been annoying me for several years (on several ready-made NAS boxes) though was the software in general: either it was propietary, or it was Linux-based but modified for the NAS hardware. In both cases the manufacturer stopped updating it, and -if at all possible- updating the firmware and OS was a major hassle.
So I was wondering: why not get a bare RAID enclosure, and make a NAS from a Raspberry Pi?
My system would have the following hard requirements:
- RAID-1 support, with other RAID types as a bonus
- IPv6 support
- Accessible through ssh
- Ability to automatically go to sleep or shut down when not in use (both because of power saving and because RAID enclosures are noisy)
Points 1, 2 andd 3 are easy: Raspbian (and many other operating systems) have decent software RAID support, and of course fully support IPv6.
Point 4 however, was an issue: Not only does the Raspberry Pi not have a real way of shutting down, it also doesn’t support wake-on-lan, which would be the easiest way to power it up again.
But there’s nothing some additional hardware can’t fix.
One way to overcome that would be to power it through a smart power hub, and simply enable/disable power as needed. But there would be a drawback: simply cutting power is dangerous when doing file-system intensive things, such as backups. I wouldn’t want to shut it down halfway through a write operation.
But I found something else: The Suptronics X725 expansion board. This provides 3 things:
- Option to fully shut down the raspberry pi
- UPS functionality with a few batteries
That third one is a bonus that makes this a better solution to the smart power outlet option: not only can we have controlled shutdowns, we can also have them when the power is out! Although, the most useful thing for this would be to prevent data write errors in case of a power loss, which in the current setup wouldn’t actually work, since the RAID enclosure has its own power supply (without UPS, atm).
The documentation on the X725 is a bit on the sparse side though; it has several bold-lettered but not-so-clear warnings about how to blow up your hardware. So let’s start with that.
With the board placed on the Pi, there’s three ways to power the board and the Pi. USE ONLY ONE OF THEM.
- The USB-3 socket on the Pi itself
- The micro-USB socket on the board
- The power plug socket on the X725
On thing that makes this a bit scary it that there are 2 micro-usb ports on the board. The usb power socket is the one on the long side (it has the helpful text “2A CHG” next to it.
So what’s the other micro-usb for? It’s for the second network interface. Since the Pi can’t do wake-on-lan, this board adds a network interface that does support it, but it works through usb.
With that, I have a system that is low-powered, well-supported by software, and able to wake up in the middle of the night to perform backups, then go to sleep again.