Create an Image of a SD Card

The following command works on both OS X and Linux.  It creates an image from the SD card called raspi.img which you can later use to clone to another SD Card or just keep as a backup.  It is exceptionally useful for backing up a Raspberry Pi.

Replace “mmcblk0” with your SD cards name.  Take a look at this post if you need help finding the name.

sudo dd if=/dev/mmcblk0 of=~/raspi.img