Thanks to various donations and competition wins, and by raiding the family collection, I now have enough Pis for 10 children. I tested the school Computing Suite infrastructure with and end-of term Pi Minecraft edition session (with the younger CodeClub) before the holidays so I'm reasonable confident that I have everything I need.
I'd like the Pis to all run the latest Raspbian UI, but that will mean updating all the SD cards I burned in December. I could just lets the children do the update during the session, but to be honest, watching apt-get upgrade running is not that much fun or all that informative (I'll get them to perform some updates, but I don't want them to have to wait for a whole load of packages to install).
When I burned the cards before Xmas, I just used a single USB reader/writer, doing all 10 over the course of a few days using dd. Invariably it took longer than necessary because I'd leave one copying job running and then forget about it. It seemed like the whole process was ripe for automation, so I purchased a couple more cheap readers/writers from eBay and dug out my USB hub.
Because I have some full size SD cards and some micro SD cards (with adapters to allow use in model Bs), I have two reader/writers for each size of card.
The excellent enhanced version of dd - dcfldd - allows you to create multiple output copies of whatever input you give it, and also has some extra options to monitor progress. You can install it using
apt-get install dcfldd
A few fairly un-scientifc tests suggested that performance was not significantly degraded by writing multiple copies: a 4 GB image file took 20 minutes when writing 4 copies (2 SD and 2 micro SD). That means I can create a full set of 10 in under an hour!
It's very simple to run from the command line:
dcfldd if=ImageFileToBeCopied.img of=/dev/sda of=/dev/sdb of=/devsdc of=/dev/sdd sizeprobe=if
The 'sizeprobe' argument is optional but tells dcfldd to display a helpful percentage progress value which is quite helpful in seeing how far the copying has got and how much time remains.
Finally, because I'm toying with the idea of using my UnicornHat to display progress, I also wrote a simple Python wrapper to log events to a file.
tool = subprocess.Popen(['dcfldd', 'if=CodeclubJan15.img', 'of=/dev/sdd','of=/dev/sdc', 'of=/dev/sdb', 'of=/dev/sda', 'statusinterval=4092', 'sizeprobe=if'], stderr=subprocess.PIPE)
tee = subprocess.Popen(['tee', 'log_file'], stdin=tool.stderr)