In the words of the Rapberry Pi “Two is better than one.” FrankenPi was born. I have a Zyxel GS-105B switch (Mine is an early one that is smaller than later models with the same code.) that has a full metal case. I decided to drill two holes in the switch case and attach two silver (Long) metal motherboard securing nuts. Now the Pi has two securing holes already created on the board however I discovered these are too small for the securing nuts so in classic low tech style I used a Philips screw driver as a drill come borer and widened the holes to accommodate the threads. I then screwed two nuts together, which is the right height to accommodate the second Pi and secured the first Pi by screwing the two nuts on to the thread repeating the process for the second Pi (I shall repeat this part again when I get two more Pi’s).
Because the Pi’s are bolted to the switch there’s no need in my opinion to have the standard 1 metre long cables so I had some custom cables made up at work. I’ve had to guess the length for Pi’s 3 & 4 as I don’t have them yet but I’m confident the cables are long enough.
I’m using 16GB SD cards and Raspbian. Having installed to FrankenPi-01 I set the network to a static IP (Use the text editor of your choice)
sudo vim /etc/network/interfaces
Hopefully you know how to operate your text editor of choice so I won’t go into that here. You need to change the defaults from dhcp to static and should look like this example;
iface eth0 inet static
I then edited my hosts and hostname files to FrankenPi-01
sudo vim /etc/hosts
sudo vim /etc/hostname
Next step for me was to fetch all the latest updates and install tmux (FrankenPi-01 will be the master Pi) with that done it was time for some cool time-saving stuff and clone FrankenPi-01. As I’m 100% Linux at home I will be using dd and I’m also fortunate to have a card reader.
Insert SD card and from a terminal issue the fdisk command:
sudo fdisk -l
This will tell you the cards name, for me it is /sdd Next decide where you want to store the copy of FrankenPi-01 (Amend to your hostname accordingly) for me it is /run/media/peter/Storage/FrankenPi/FrankenRaspian The FrankenRaspbian can be anything, you can name it dogbreath for all it matters it’s just the name of the output file and you can store it in your /home directory if you prefer.
So now we are ready to start copying (Backup) our installation. ¹
sudo dd if=/dev/sdd of=/run/media/peter/Storage/FrankenPi/FrankenRaspian
Be aware, dd does not have a progress output which is pretty poor if you ask me. The only way you know anything is happening is the status light on your reader will flash and the hard drive activity light on your PC will blink like crazy. There are some solutions on the web to add a progress capability but they’re all a bit of faff imo. I have a pretty good spec machine yet it still took 45 minutes to copy the contents of the 16GB SD card to my HDD². Once the job has finished you will be returned to a normal command prompt at the terminal. Now we are now ready to in effect clone FrankenPi-01 and create FrankenPi-02 insert a new SD card and issue this command:
sudo dd if=/run/media/peter/Storage/FrankenPi/FrankenRaspian of=/dev/sdd
It’s basically the same command only in reverse. BE WARNED this will erase all data on the destination so make sure your location (SD card) is correct. Voilà! We now have two Pi’s exactly the same, be aware they both have the same IP address. The way I solved this was to disconnect the FrankenPi-01 network cable, then boot FrankenPi-02 I then changed the IP address as per the instructions earlier although in this case it’s even easier as all we have to do is change 30 to 31. I then booted and ssh’d into FrankenPi-01 and from there ssh’d into FrankenPi-02
Finally I thought it would be nice to label everything up so I made a little name tag for the switch and some info labels for each SD card. As soon as I have -03 and -04 I’ll label those up as well. My initial idea was/is to create a cluster of some kind however everyone keeps saying “Well, it depends on what you want to do?” which is about as helpful as a one-legged man in a bum kicking competition. My perception of a cluster, or is it nodes? is for one master and slaves taking on some of the load? I’m currently looking at some “MySQL cluster” tutorials so I may well go down that path.
If I don’t lose interest, in part two I will be adding a six port USB hub, a three output power cable and an external hard drive.
¹ Daniel Bos suggested creating a partition just big enough to hold the install and then growing the partition (Afterwards) to the full 16GB. It’s workable but effectively a two stage install and the idea is to save time.
² Matthew Copperwaite suggested using the bs=1M flag with the dd command. Effectively it says “Transfer bytes size = 1meg”.