Low Orbit Flux Logo 2 F

Raspberry Pi - How To Backup or Clone SD Card

It is a good idea to backup your Raspberry Pi’s SD card. There are two main options to do this and there are different variations of these options. The first option is to backup to a second SD card directly from the Pi. The second option is to back it up to an image file from a separate system.

Clone the SD Card to Another Card from the Raspberry Pi

You can clone your SD card directly from your Raspberry Pi while it is running. You just connect another SD card and use the SD card copier application that comes with Raspberry Pi OS. This should work with both NOOBS and Raspberry Pi OS images. This will backup your entire system.

The destination card can be larger or smaller than the current system card so long as there is enough space on the card to fit all files. If there isn’t enough space you will receive a warning.

WARNING - This will wipe all data on the destination card.

Raspberry Pi SD Card Backup Steps:

Clone the SD Card to an Image File

You can also clone your SD card to an image file. This is great for a few reasons:

These instructions should work from a Mac or from Linux. A Mac will use 4m instead of 4M.

Backup SD card to image:

sudo dd bs=4M if=/dev/sdb of=backup1.img

Restore image to SD card:

sudo dd bs=4M if=backup1.img of=/dev/sdb

Backup SD card to compressed image:

sudo dd bs=4M if=/dev/sdb | gzip > backup1.img.gz

Restore compressed image to SD card:

gunzip --stdout backup1.img.gz | sudo dd bs=4M of=/dev/sdb