I know there was a thread on this a while back but I cant seem to find it now ... Lots of info out there on copying a single image to a single card but ...
I've got a nice up to date working image of Raspbian that's set up with a few extras installed such as Geany copied to a hard disk.
I've copied this image successfully to another SD card using Win32 Disk Imager.
The problem is I've got fifteen SD Cards to copy.
Equipment I've got to hand is
a number of 10 port USB hubs
15 rev 2 Raspberry Pi's
Some Windows Computers (but only have admin access and therefore ability to run W32 Disk Imager on one computer.)
What's the best way of copying the image to 10 or 15 cards at once - (it's not a problem if it needs to run overnight)
Copy image to multiple SD Cards.
11 posts
Pi1 (Nov 2012 loft)= 1KW immersion controller for Solar panel
Pi2 (Jan 2013 living room)=Play thing
Pi3 (Feb 2013 mobile)= Play thing with Tandy Ladder board,breakout board,Nokia display
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=26&t=28193
Pi2 (Jan 2013 living room)=Play thing
Pi3 (Feb 2013 mobile)= Play thing with Tandy Ladder board,breakout board,Nokia display
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=26&t=28193
- Posts: 87
- Joined: Mon Nov 26, 2012 8:48 pm
- Location: Ipswich, Suffolk, England, UK.
http://raspberrypi.stackexchange.com/qu ... o-many-sds
Okay ..
Theoretically ...
from http://raspberrypi.stackexchange.com/qu ... spberry-pi
So , could I plug a load of SD Card readers & cards into a multi-port hub on a Raspberry Pi
Start one dd copy process going
Detach it - (using something like nohup? or Screen?)
Start the next one going...
Repeat process until all cards are being written
Go home for the weekend
Come back on Monday to 15 written SD cards?
Given that no-one seems to have produced a multi-card SD card reader (one that can hold multiple SD cards at once) and the fact that that you can buy a USB hub and a bunch of single SD card USB readers very cheaply, one way to speed up the process would be to make your own SD card duplicator.
Okay ..
Theoretically ...
from http://raspberrypi.stackexchange.com/qu ... spberry-pi
Creating a disk image will preserve not only files but also the filesystem structure and when you decide to flash your new SD card, you will be able to just plug it in and it will work.
On Linux, you can use the standard dd tool:
dd if=/dev/sdx of=/path/to/image bs=1M
Where /dev/sdx is your SD card.
So , could I plug a load of SD Card readers & cards into a multi-port hub on a Raspberry Pi
Start one dd copy process going
Detach it - (using something like nohup? or Screen?)
Start the next one going...
Repeat process until all cards are being written
Go home for the weekend
Come back on Monday to 15 written SD cards?
Thinking about this a bit more ...
I think it would be generally useful to have a Bash script that could automate the entire process. - to be shared with schools who need to setup lots of Pis in a batch job.
Assume You have a Raspberry Pi with a powered USB hub plugged in
The output might go something like this...
pi@raspberry ~ $ clonedisks
Insert the master disk into a USB port and press Enter >
Checking disk ... ok
Insert a blank disk for copying into a new USB port and press Enter >
...ok. Do you want to copy another y/n? > y
Insert a blank disk for copying into a new USB port and press Enter >
...ok. Do you want to copy another y/n? > y
Insert a blank disk for copying into a new USB port and press Enter >
...ok. Do you want to copy another y/n? > y
Insert a blank disk for copying into a new USB port and press Enter >
...ok. Do you want to copy another y/n? > n
Ready to clone disks. Press enter when ready>
Copying ...
...
...
...
Done.
pi@raspberry ~ $
I think it would be generally useful to have a Bash script that could automate the entire process. - to be shared with schools who need to setup lots of Pis in a batch job.
Assume You have a Raspberry Pi with a powered USB hub plugged in
The output might go something like this...
pi@raspberry ~ $ clonedisks
Insert the master disk into a USB port and press Enter >
Checking disk ... ok
Insert a blank disk for copying into a new USB port and press Enter >
...ok. Do you want to copy another y/n? > y
Insert a blank disk for copying into a new USB port and press Enter >
...ok. Do you want to copy another y/n? > y
Insert a blank disk for copying into a new USB port and press Enter >
...ok. Do you want to copy another y/n? > y
Insert a blank disk for copying into a new USB port and press Enter >
...ok. Do you want to copy another y/n? > n
Ready to clone disks. Press enter when ready>
Copying ...
...
...
...
Done.
pi@raspberry ~ $
A nice little script will do that for you
If you mount all the devices then try ...
#!/bin/bash
for i in 1 2 3 4 5
do
echo "Starting to program $i"
dd if=/path/to/image of=/dev/sd$i bs=1M
echo "We have completed $i"
done
I have not tested this substitution of the loop variable $i in this ... maybe make a string of it and use "of=string"
My rPi is in the loft switching on and off the 1Kw hot water heater in this sun shine
#!/bin/bash
for i in 1 2 3 4 5
do
echo "Starting to program $i"
dd if=/path/to/image of=/dev/sd$i bs=1M
echo "We have completed $i"
done
I have not tested this substitution of the loop variable $i in this ... maybe make a string of it and use "of=string"
My rPi is in the loft switching on and off the 1Kw hot water heater in this sun shine
Pi1 (Nov 2012 loft)= 1KW immersion controller for Solar panel
Pi2 (Jan 2013 living room)=Play thing
Pi3 (Feb 2013 mobile)= Play thing with Tandy Ladder board,breakout board,Nokia display
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=26&t=28193
Pi2 (Jan 2013 living room)=Play thing
Pi3 (Feb 2013 mobile)= Play thing with Tandy Ladder board,breakout board,Nokia display
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=26&t=28193
- Posts: 87
- Joined: Mon Nov 26, 2012 8:48 pm
- Location: Ipswich, Suffolk, England, UK.
jamiesk wrote:A nice little script will do that for youIf you mount all the devices then try ...
Excellent, thank you! I haven't made one of these since nineteen ninety something so tinkering with this will make a nice little Christmas holiday project...
jamiesk wrote:My rPi is in the loft switching on and off the 1Kw hot water heater in this sun shine
Lucky you! Most of the country here seems to now be underwater
jamiesk wrote:#!/bin/bash
for i in 1 2 3 4 5
do
echo "Starting to program $i"
dd if=/path/to/image of=/dev/sd$i bs=1M
echo "We have completed $i"
done
This would do one after the other in a queue which is fine, however I'm wondering if it might be possible to make all the cards copy the from master in parallel /at the same time (not even sure if it would be possible like that with dd) by detaching the processes, and would that even make the job finish any faster.
Yes you can. I would think it would go faster due to writing to a card is slower than reading.
Google found me http://superuser.com/questions/145516/c ... ltaneously which basically says
But how will you catch errors ? Or do you care?
I would put together files for each copy like (NOT TESTED)
and then call them all from a main one
And then each will send you an email of how it did. Assuming you have email setup!!
But you said it could be an overnighter, I would have hoped that 15 times 4G cards would be written a bit quicker than an overnighter!!!
Google found me http://superuser.com/questions/145516/c ... ltaneously which basically says
- Code: Select all
cat drive.image | tee >(dd of=/dev/sda) >(dd of=/dev/sdb) >(dd of=/dev/sdc) | dd of=/dev/sdd
But how will you catch errors ? Or do you care?
I would put together files for each copy like (NOT TESTED)
#!/bin/bash
# for SD1
dd if=/path/to/image of=/dev/sd1 bs=1M > /tmp/sd1
mail -s "Sd1 done" you@email.com <~/email.done
and then call them all from a main one
#!/bin/bash
# to run all files from SD1 to SD5
./SD1 &&
./SD2 &&
./SD3 &&
./SD4 &&
./SD5 &&
And then each will send you an email of how it did. Assuming you have email setup!!
But you said it could be an overnighter, I would have hoped that 15 times 4G cards would be written a bit quicker than an overnighter!!!
Pi1 (Nov 2012 loft)= 1KW immersion controller for Solar panel
Pi2 (Jan 2013 living room)=Play thing
Pi3 (Feb 2013 mobile)= Play thing with Tandy Ladder board,breakout board,Nokia display
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=26&t=28193
Pi2 (Jan 2013 living room)=Play thing
Pi3 (Feb 2013 mobile)= Play thing with Tandy Ladder board,breakout board,Nokia display
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=26&t=28193
- Posts: 87
- Joined: Mon Nov 26, 2012 8:48 pm
- Location: Ipswich, Suffolk, England, UK.
you said it could be an overnighter, I would have hoped that 15 times 4G cards would be written a bit quicker than an overnighter!!!
Originally I thought it could be but it would be good if we can make it go faster. If it could do a batch in a lunch break (doubtful but worth a go) that would be good.
Give it a go. Have one of the science kids with a stopwatch too 
Also make sure the master has had the file expanded to the full size of the SD card too. You will be copying it, might as well make it right in the first place.
Also make sure the master has had the file expanded to the full size of the SD card too. You will be copying it, might as well make it right in the first place.
Pi1 (Nov 2012 loft)= 1KW immersion controller for Solar panel
Pi2 (Jan 2013 living room)=Play thing
Pi3 (Feb 2013 mobile)= Play thing with Tandy Ladder board,breakout board,Nokia display
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=26&t=28193
Pi2 (Jan 2013 living room)=Play thing
Pi3 (Feb 2013 mobile)= Play thing with Tandy Ladder board,breakout board,Nokia display
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=26&t=28193
- Posts: 87
- Joined: Mon Nov 26, 2012 8:48 pm
- Location: Ipswich, Suffolk, England, UK.
Another way to copy to multiple cards simultaneously is to install and use the dcfldd package. It is like an enhanced version of dd with lots of useful extra options.
As an example (disclaimer - I haven't actually tired this as I don't have any spare cards right now), I'd use:
As you can see, it supports multiple "of=" statements, and the "sizeprobe=if" means "Show a continuous progress report calculated using the size of the input file"
As an example (disclaimer - I haven't actually tired this as I don't have any spare cards right now), I'd use:
- Code: Select all
dcfldd if=/path/to/image bs=1M sizeprobe=if of=/dev/sda of=/dev/sdb of=/dev/sdc (etc...)
As you can see, it supports multiple "of=" statements, and the "sizeprobe=if" means "Show a continuous progress report calculated using the size of the input file"
- Posts: 722
- Joined: Sun May 06, 2012 5:17 am
- Location: Essex, UK