Welcome again to another short Adam O’Grady tutorial! This time I’m going to run through the brief process of cloning an SD card. This is particularly useful for backing up things such as images of Raspberry Pi installs and can be extended to use with USB flash drives that are used for boot images as well (or actually most other drive types).
Disconnect the SD card you want to back up, open up a Terminal prompt and run
df -h. Plug in the device and run
df -h again and note down which device has now appeared, it should usually be in a form similar to /dev/disk1s1. We’ll need to remember the disk, but not the partition (we don’t need the ‘s1’ section), we’ll also want to put the letter ‘r’ before the disk to access the raw (not buffered) disk for faster speeds. So what we’ll need to enter next for the disk location should be similar to /dev/rdisk1. Now run the following command to initiate the backup, it will take some time:
$ sudo dd bs=1m if=[DISK LOCATION] of=~/Documents/backup.img
Once this is complete, you should have a backup image located in your Documents folder that you can store for safekeeping!