Skip to content

Instantly share code, notes, and snippets.

@STrRedWolf
Last active September 4, 2017 15:55
Show Gist options
  • Save STrRedWolf/5a6c0a10031c95aa8aeaad6016666c3f to your computer and use it in GitHub Desktop.
Save STrRedWolf/5a6c0a10031c95aa8aeaad6016666c3f to your computer and use it in GitHub Desktop.
Pi Zero cluster setup.

A bit of a Pi Zero cluster setup I'm getting together, with some setup notes in case I have to rebuild it.

Four Pi Zero's connected to a Pi 2, which is connected to the network via Ethernet or Wifi.

The below script should leave the Pi Zero's mounted to verify things.

#!/bin/bash
c=1
for i in d e f g; do
mkdir pi-$i
mount /dev/sd${i}2 pi-$i
mount /dev/sd${i}1 pi-$i/boot
echo " " > pi-$i/boot/ssh
echo -e "\ndtoverlay=dwc2" >> pi-$i/boot/config.txt
mv pi-$i/boot/cmdline.txt pi-$i/boot/cmdline.txt.old
sed 's/$/ modules-load=dwc2,g_ether/' pi-$i/boot/cmdline.txt.old > pi-$
echo "pinode$c" >> pi-$i/etc/hostname
mv pi-$i/etc/hosts pi-$i/etc/hosts.old
sed "s/raspberrypi/pinode$c/" pi-$i/etc/hosts.old > pi-$i/etc/hosts
c=$(( c+1 ))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment