Difference between revisions of "MicroSd"

From Gumstix User Wiki
Jump to: navigation, search
(Created page with '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 CO…')
 
Line 21: Line 21:
 
  rm /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 [[http://www.gumstix.net/Setup-and-Programming/view/Overo-Setup-and-Programming/Creating-a-bootable-microSD-card/111.html|here]] for hints) and copy over the required files.
+
Note for large cards, it may be faster to create a script to format the card (see [http://www.gumstix.net/Setup-and-Programming/view/Overo-Setup-and-Programming/Creating-a-bootable-microSD-card/111.html|here] 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 [[http://old.nabble.com/Duplicating-SD-cards-td27947599.html#a27947920|this thread]] for the full discussion.
+
Thanks to Dave Hylands, Ananth and Coderone for their mailing list replies and to Doug Gibbs who posed the original question. See [http://old.nabble.com/Duplicating-SD-cards-td27947599.html#a27947920|this thread] for the full discussion.

Revision as of 12:51, 1 April 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 /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.