Home Backup Raspberry Pi SD Card
Post
Cancel
Preview Image

Backup Raspberry Pi SD Card

Insert the SD Card into a card reader on the Mac. Open Terminal and enter the following command to locate the SD Card:

diskutil list

All disks will be listed, and will look something like below:

Look for the SD card by looking for a disk of the right size and name. In the above example, the SD Card is /dev/disk1.

In the Downloads folder create a dummy file SDCardBackup.dmg. Next, in Terminal, enter the following command to create a disc image (.dmg) of the SD Card, dragging the dummy file onto Terminal window to get the full path.

sudo dd if=/dev/disk1 of=<fullpath>/SDCardBackup.dmg

Wait until the SD card has been completely read; this takes some time and the command does not show any feedback. Wait for the command prompt to reappear in the terminal window once it is complete.

Restore it by following the same approach as above to locate the SD card. Before writing to the card ‘unmount’ it so that the operating system does not try to write to it at the same time. Use the following in the Terminal:

diskutil unmountDisk /dev/disk1

Then use the this to write the image back to the SD card:

sudo dd if=<fullpath>/SDCardBackup.dmg of=/dev/disk1

Once it has finished writing the image to the SD card, unmount the card as below and remove from the Mac:

sudo diskutil eject /dev/disk1

References / Resources

This post is licensed under CC BY 4.0 by the author.
Recently Updated
Trending Tags
Contents
Trending Tags