In the following I will explain on how you can backup your Pi’s SD-card, so that whenever it breaks down, you can simply restore the backup image to a fresh SD-Card. This may also help with tinkering, when you totally screwed up your Pi’s Linux-installation. I will explain the first step specifically for Mac OS X, but you can do this similarly on other UNIXes and Linux, by using the mount and umount commands.
So, shut down your Pi using the command sudo shutdown -h now and remove the SD-card after the Pi has done so. Take the card and insert it into your Mac’s SD-card slot.
First of all, we need to find out which disk device has been assigned to the card. We can do this with diskutil list:
Then unmount the card using diskutil unmountDisk:
Next we will use dd to produce an image, which we can compress using bzip2, or pbzip2 for more performance. You can use MacPorts to install pbzip2.
Restoring the image is also easy: