Difference between revisions of "MicroSd"

From Gumstix User Wiki
Jump to: navigation, search
(Creating a compressed image)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
----
 
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
 
----
 
=[http://imyqokyf.co.cc Under Construction! Please Visit Reserve Page. Page Will Be Available Shortly]=
 
----
 
=[http://imyqokyf.co.cc CLICK HERE]=
 
----
 
</div>
 
 
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 12: Line 4:
  
 
===Creating a Basic Card Image===
 
===Creating a Basic Card Image===
 +
'''Note 1:''' before executing the commands below you will need to "umount" the partitions of the card that has been inserted in your computer (you may want to insert more than one card). For example, if your partitions are located in /dev/sde0 and /dev/sde1, the first thing you would have to do is:
 +
sudo umount /dev/sde0
 +
sudo umount /dev/sde1
 +
'''Note 2:''' super user access (sudo) may be required to execute the following commands.
 +
 +
'''Commands to create a Basic Card Image:'''
 
  dd if=/dev/sourcecard of=/home/user/masterimage.img bs=1M
 
  dd if=/dev/sourcecard of=/home/user/masterimage.img bs=1M
 
  dd if=/home/user/masterimage.img of=/dev/destcard bs=1M
 
  dd if=/home/user/masterimage.img of=/dev/destcard bs=1M
Line 23: Line 21:
 
===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 &gt; somefile.gz
+
  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/.
Line 29: Line 27:
 
  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] 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.org/create-a-bootable-microsd-card.html] 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://gumstix.8.x6.nabble.com/Duplicating-SD-cards-td569365.html this thread] for the full discussion.

Latest revision as of 14:09, 1 April 2016

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

Note 1: before executing the commands below you will need to "umount" the partitions of the card that has been inserted in your computer (you may want to insert more than one card). For example, if your partitions are located in /dev/sde0 and /dev/sde1, the first thing you would have to do is:

sudo umount /dev/sde0
sudo umount /dev/sde1

Note 2: super user access (sudo) may be required to execute the following commands.

Commands to create 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 this thread for the full discussion.