Clone Your Micro SD Directly on Raspberry Pi
It is always a good idea to have a backup a clone of your micro SD for at least 2 main reasons:
- AC Power failure could cause your RPi to corrupt files on the SD if it was busy writing during the power failure.
- For the adventurers between us that like to tinker/hack/add to the Pi all the time. We might not like the new changes or even break the OS and need a quick way to go back to the image before the changes were made.
What you will need
A fully setup Raspberry Pi with the SD card image that you would like to clone
SD card copier
One query which comes up a lot on the forums is about the best way to back up your Pi. People also want to know how to migrate their Raspberry Pi OS install to a new SD card which is larger or smaller than the one they are using at the moment. This has been difficult with the command-line tools that we’ve recommended in the past. Finally there is now a new application to help with this. You’ll find it in the menu under ‘Accessories’.
The SD Card Copier application will copy Raspberry Pi OS from one card to another – that’s pretty much all it does – but there are several useful things that you can do as a result. To use it, you will need a USB SD card writer.
To take a common example:
What if you want to back up your existing Raspberry Pi OS installation?
Put a blank SD card in your USB card writer and plug it into your Pi. And then launch SD Card Copier.
In the ‘Copy From Device’ box. Select “Internal SD Card”, and then select the USB card writer in the ‘Copy To Device’ box. Where it will probably be the only device listed.
Press ‘Start’. Watch the messages on the screen and wait. In ten or fifteen minutes, you should have a clone of your current installation on the new SD card.
You can test it by putting the newly-copied card into the Pi’s SD card slot and booting it. It should boot and look exactly the same as your original installation. With all your data and applications intact.
You can run directly from the backup
If you want to recover your original card from your backup, simply reverse the process. Boot your Pi from the backup card. Put the card to which you want to restore into the SD card writer, and repeat the process above.
The program does not restrict you to only copying to a card the same size as the source; you can copy to a larger card if you are running out of space on your existing one, or even to a smaller card. As long as it has enough space to store all your files – the program will warn you if there isn’t enough space.
It has been designed to work with Raspberry Pi OS and images installed using the Raspberry Pi Software installer. It may work with other OSes or custom card formats, but this can’t be guaranteed.
The only restriction is that you cannot write to the internal SD card reader, as that would overwrite the OS you are actually running, which would cause bad things to happen.
Please also bear in mind that everything on the destination card will be overwritten by this program, so do make sure you’ve got nothing you want to keep on the destination card before you hit Start!
Original article by Simon Long