Configuring Raspberry Pi Cluster

Yuhei Horibe
3 min readApr 23, 2020

--

Raspberry Pi Cluster (hardware)

Motivation

I’ve been using Raspberry Pis as home servers, as well as development PC for learning. But, unfortunately, I had few Raspberry Pis unused and stuck in the storage. So I decided to build the cluster using those excess Raspberry Pis (and Zedboard). Those will be used for further leaning.

This cluster, isn’t just 6 computers connected together via Ethernet. The concept of this Raspberry Pi cluster is, Disk-less (more accurately, SD card-less). This is for both, cost efficiency, and maintainability. SD cards are only used when booting…in this sense, it’s not “entirely” disk-less, but enough.

I’ve had bad experiences with SD cards. Those are not really reliable, and fails often. Also, every time I build new kernel, or every time I make backups, it requires me physical access to the SD card, which is annoying (also, I have to make backups often, because it fails often…).

I’ll show you how I overcame those problems.

Configuration

Here’s the conceptual picture of the Raspberry Pi cluster. Hardware building part is written here.

DIY Raspberry Pi cluster

Raspberry Pi cluster configuration overview

The head node

The head node has an external SSD connected via USB 3.0. This node is booting from the SD card, and mounting the root filesystem from SSD. This makes SD card “read only”. Then, this head node will host the “TFTP server” and “NFS” to share the storage for the rest in a cluster.

By the way, this external SSD is entirely encrypted. To make it usable as root filesystem, I used “initramfs”. I’ve written the article about this here.

Mounting encrypted root file system

Also, Linux kernel for all the cluster node (except Zedboard) are compiled to AARCH64 binary, and root filesystem is arm64 version of Ubuntu18.04. The details can be found here.

Building and booting fully customized OS on Raspberry Pi

Cluster nodes

All the other cluster nodes have additional bootloader “u-boot”, to make it bootable from network. It’s renamed to “kernel8.img”, and put it in SD card. Details are written in the link below.

Booting Linux from netrowk

By doing so, those cluster nodes can download “Linux kernel” and “Device Tree Blob” (and additional boot script) from TFTP server. This means, kernel update is done entirely via network (The root filesystem can be mounted to my desktop computer via NFS, so that, kernel modules can be installed from there). I don’t have to touch SD card at all!!

What’s more is, because all those Raspberry Pi nodes (except Zedboard) are sharing exactly the same root filesystem, all the update work and software setup would be done on just one machine. After updating one of the nodes, I just simply restart all the other nodes, then everything is ready!! (kernel update for the head node is a bit tricky).

This is the whole story about Raspberry Pi cluster building.

--

--

No responses yet