Wednesday, June 15, 2016

Clone SD Card Image (Mac)

I've started using Raspberry Pie. Backing up the SD Card image and restore is a quick way to test things out.

First check which disk the SD card is using

diskutil list

then copy raw format of the card to image file while at the same time compress it to save some space

sudo dd if=/dev/rdisk2 bs=1m | gzip > ~/Desktop/pi.gz

To restore image to SD, first unmount the card by

diskutil unmountDisk /dev/disk2


gzip -dc ~/Desktop/pi.gz | sudo dd of=/dev/rdisk2 bs=1m

this could take a while

(to eject disk)
diskutil eject /dev/disk2