Sunday, December 20, 2009

Creating SD Card Images

This short tutorial shows you how to dump an SD card image (this one, in particular, is for the overobuntu SD cards). This tutorial assumes you are using some form of *nix (Unix, Linux, etc) and have access to the dd command line tool.

First, in order to use the dd tool properly, we need to set the block size and number of bytes that you want to copy. For this tutorial, we're going to make blocks 512 bytes.

If you want to copy 1GB, using 512 byte blocks, then we need 1073741824 / 512 = 2097152 blocks. NOTE: When you're figuring out how many bytes you need, make sure you calculate in bytes (ie: 1GB is not 1 billion bytes, but 2^30 = 1073741724 bytes).

The command to do this copy from your SD card (assuming your SD card is mounted at /dev/mmcblk0) is the following:

dd if=/dev/mmcblk0 of=card.image bs=512 blocks=2097152

if = the input source device
of = the image where the data is going to be dumped
bs = the block size (512 is a sensible default)
blocks = the number of blocks you wish to copy (number of bytes / block size).