Difference between revisions of "MicroSd"
Aqisecoxefi (Talk | contribs) |
Searchworks (Talk | contribs) (remove spam) |
||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
It is possible to duplicate a microSD using a few simple tools in Linux. This can be useful once you have a known good image that you want to replicate for a bunch of Gumstix COMs. | It is possible to duplicate a microSD using a few simple tools in Linux. This can be useful once you have a known good image that you want to replicate for a bunch of Gumstix COMs. | ||
Line 23: | Line 15: | ||
===Creating a compressed image=== | ===Creating a compressed image=== | ||
You can also compress the image on disk but be warned that you need to do this as the root user. | You can also compress the image on disk but be warned that you need to do this as the root user. | ||
− | dd if=/dev/sourcecard bs=1M | gzip -c | + | dd if=/dev/sourcecard bs=1M | gzip -c > somefile.gz |
gunzip -c somefile.gz | dd of=/dev/destcard bs=1M | gunzip -c somefile.gz | dd of=/dev/destcard bs=1M | ||
To make even smaller image files, zero out all remaining space on your microSD card partitions before doing the two steps above. For example, let's say your Ext3 partition is mostly empty and is mounted at /mnt/card_ext/. | To make even smaller image files, zero out all remaining space on your microSD card partitions before doing the two steps above. For example, let's say your Ext3 partition is mostly empty and is mounted at /mnt/card_ext/. |
Revision as of 15:34, 23 November 2010
It is possible to duplicate a microSD using a few simple tools in Linux. This can be useful once you have a known good image that you want to replicate for a bunch of Gumstix COMs.
The Use-Cases below assume a source card found at /dev/sourcecard and a destination card at /dev/destcard. Note, you can use 'dmesg' or 'mount' to confirm the actual mounting location; they are probably something like /dev/sde. Also, we are interested in the actual card device (e.g. /dev/sde) rather than the block devices representing any partitions it may have (e.g. /dev/sde0, /dev/sde1).
Creating a Basic Card Image
dd if=/dev/sourcecard of=/home/user/masterimage.img bs=1M dd if=/home/user/masterimage.img of=/dev/destcard bs=1M
Specifying a block size of 1MB should speed up the transfer.
If you happen to have two microSD slots so both cards are simultaneously available, you can do a direct copy:
dd if=/dev/sourcecard of=/dev/destcard bs=1M
For touchscreen boards, you'll redo the calibration for each board. Be sure to remove the /etc/pointercal file from the master image.
Creating a compressed image
You can also compress the image on disk but be warned that you need to do this as the root user.
dd if=/dev/sourcecard bs=1M | gzip -c > somefile.gz gunzip -c somefile.gz | dd of=/dev/destcard bs=1M
To make even smaller image files, zero out all remaining space on your microSD card partitions before doing the two steps above. For example, let's say your Ext3 partition is mostly empty and is mounted at /mnt/card_ext/.
dd if=/dev/zero of=/mnt/card_ext/mybigfile rm /mnt/card_ext/mybigfile
Note for large cards, it may be faster to create a script to format the card (see [1] for hints) and copy over the required files.
Thanks to Dave Hylands, Ananth and Coderone for their mailing list replies and to Doug Gibbs who posed the original question. See thread for the full discussion.