Filippo Valsorda's "frood" Is a Hoopy Immutable NAS Running Entirely From an Initial RAM Filesystem
From guaranteed boot-up to easy A/B testing, there's a lot to recommend this Alpine Linux-based rootfs-free setup.
Cryptography engineer Filippo Valsorda has set up a network attached storage (NAS) system with a difference: it lacks the usual root filesystem, and instead operates entirely from an immutable initial RAM filesystem (initramfs
).
"My NAS, frood, has a bit of a weird setup. It's just one big initramfs
containing a whole Alpine Linux system," Valsorda explains. "It's delightful and I am not sure why it's not more common. I’ve always liked running systems from memory: it’s fast and prevents wear on the system storage device, which is often some janky SD Card, because the good drives are dedicated to the ZFS pool. However, you immediately have the problem of how to persist configuration changes."
Traditionally, Alpine Linux users solve this problem using diskless mode — which uses an immutable filesystem with an overlay file to track desired changes. For Valsorda, though, this was undesirably, partly due to the complexity of the tools involved and partly due to a desire to be able to track changes using the Git version control system.
"When it boots, Linux expects an 'initramfs
' image. It’s a simple cpio
archive of the files that make up the very first root filesystem at boot," Valsorda explains of how his NAS works. "Usually the job of this system is to load enough modules to mount the real rootfs and pivot into it. Nothing stops us from putting the entire system in it, though! Who needs a rootfs
?"
By building a custom initramfs
with a "skeleton" filesystem, Valsorda's NAS gains more than just a reduction in disk writes: the engineer boasts of simple A/B testing, declarative definitions controlled from a Git repository, quick testing in the QEMU emulator, and that "configuring it doesn't look any different than configuring any regular Alpine system." System corruption and crashes, meanwhile, are a thing of the past, with the system's immutable nature meaning it comes up clean on every boot.
The full write-up is available on Valsorda's blog; the source is available on GitHub. "I have not made it into a reusable project partially because there is so little to it," the engineer explains. "Adding hooks to configure things would easily double its size. I encourage you to just fork it if you’d like."