Backup your OLinuXino/Raspberry Pi SD card

If you have modified your system a lot and don’t want to lose everything and start from scratch when your SD card gets damaged or an update breaks your system it is a good idea to create a backup of your SD card.

On Linux we can simply use the dd command for that purpose.

Create a SD card image:

[chris@thinkpad ~]$ sudo dd if=/dev/mmcblk0 of=/home/chris/olinuxino_image.img

or with compression:

[chris@thinkpad ~]$ sudo sh -c 'dd if=/dev/mmcblk0 | gzip > /home/chris/olinuxino_image.img.gz'

Restore the SD card from the image:

[chris@thinkpad ~]$ sudo dd if=/home/chris/olinuxino_image.img of=/dev/mmcblk0

or with compression:

[chris@thinkpad ~]$ sudo sh -c 'gzip -dc /home/chris/olinuxino_image.img.gz | dd of=/dev/mmcblk0'

It’s really a good idea to use compression, I’ve tried both to backup an 4 GB SD card, the image without compression has a size of 3.9 GB and that with compression is only 886.6 MB big.