Why would I backup my Pi’s SD Card?
I’m glad you asked. Having worked with virtualised operating systems (such VMWare) for over a decade I’ve gotten used to being able to create ‘snapshots’ of the virtual machines before I make any changes.
Snapshots allow me to rollback from changes to rescue a system that no longer works, or to revert changes that did not give the results expected. Because I use Windows as my everyday system I’ll provide information for creating images of the Pi’s SD Card.
When should I create a backup?
Before you make changes to your Pi you should make a backup image of the SD card. This is to ensure, as I’ve said above, that you can revert any changes that give poor results, or break the Pi.
It’s a worthwhile habit to have. At worst it will save you the time to get a system back to a working state from a failed state. Let’s move onto how we do it.
Create a backup using Windows
Step 1 – shutdown the Pi
Because we’re cool we use the terminal to shut down the Pi.
- If you’re not already logged onto the Pi, SSH in and get to the prompt.
- At the prompt type the following:
sudo shutdown -h now
- Check to make sure that the network lights are off,
- Then pull the power, and
- Pull the SD Card (a micro in the case of the Pi 3)
Step 2 – Copying the SD card to an image
Installing Win32 Disk Imager
I use Win32 Disk Imager for all the work on the Pi. This program allows you to write cards from official images and create images from current SD cards. To download the latest version head over to SourceForge and install it.
Creating a backup image
Do the following to create the image:
- Put the SD Card into your card reader on your PC
- Open Win32 Disk Imager
- Click the blue folder icon
- Choose the drive location
- I suggest creating a subfolder called Raspberry Pi Images
- Create another subfolder using the year, month, and day format (YYYY-MM-DD)
- Create a filename similar to Pre_SAMBA_Installation.img
- Click the READ button and allow that process to finish.
This completes the ‘Creating an SD backup image’ topic.