Duplicating Master into 4 Slaves

All the work so far on creating a development environment, adding languages, apache, mysql, couchdb and nagios has been on a single CD card which was referred to as PiMaster which will form the coordinating node on my super computer.

Rather that duplicate everything 4 more times for each node, we can take a copy of the PiMaster SD card and burn it onto the 4 slaves.

First we insert the PiMaster SD card into my Macbook and use df to find the number of the disk it has been assigned

sudo diskutil unmount /dev/disk2s1
sudo dd bs=1m if=/dev/rdisk2 of=./PiMasterBackup.img
sudo diskutil eject /dev/rdisk2

We now have an image PiMasterBackup.img on our hard disk, which we can copy onto the 4 slave SD cards, so we repeat the following steps for each CD in turn

sudo diskutil unmount /dev/disk2s1
sudo dd bs=1m if=./PiMasterBackup.img of=/dev/rdisk2 
sudo diskutil eject /dev/rdisk2

However this gives us 5 copies of the same SD card which all have the same ip address, server name and configuration. We now need to personalise each SD card in turn.

Set aside PiMaster SD card as that is configured as we need it. At this stage don’t put power up its PI. For this next section we use one Pi on its own, and insert, configure and then eject each slave SD card.

Repeat these steps for each slave card

  1. Power down Pi ( if not already ), making sure no other Pi’s powered up
  2. Insert Slave SD Card
  3. Power up Pi which will appear on the network as PiMaster, ip address 192.168.1.200
  4. ssh pimaster
  5. sudo vi /etc/hostname
  6. Change the name to pislaveN, where N is the number of card, 1, 2, 3 or 4
  7. sudo vi /etc/network/interfaces
  8. Change the IP address to 192.168.0.20N, where N is the number of the card
  9. sudo vi /etc/hosts
  10. Change the the name pimaster to pislaveN
  11. sudo rcconf
  12. Turn off nagios3, move the cursor down and press space, this will remove the ‘*’ from between the square brackets ‘[ ]’
  13. sudo vi /etc/mysql/my.cnf
  14. Change the value for bind-address to the ip of the slave
  15. sudo vi /etc/couchdb/local.ini
  16. Change the ipaddress for bind_address to ip address of the slave
  17. sudo reboot
  18. You should now be able to ssh into pislaveN

Repeat for cards 2, 3 and 4

Your email address will not be published. Required fields are marked *