RPi Backup and Restore

RPi Backup and Restore

Introduction – rapid deploy many or custom build one

In this topic I’ll cover the steps to backup and restore a RPi.  There are numerous write ups about the subject, so I feel a bit plagiaristic about doing this.  However, giving someone to ability to save time and effort is worth it.  I will give credit to Whitson Gordon who posted steps that I found online.  I’ll try not to be too verbatim, adding some of my reasoning and experiences.

Purpose – the kiosk users are waiting for your talents, (your name here)

Last week MCM Electronics announced the newest version of RPi available to the public.  Unlike the last change that had several physical changes, this one was more system orientated.  I won’t go into all the details, you can find it here.  Since it was such an improvement, I went ahead and ordered one.  I haven’t done much with the July 2013 release Model B+.  Most of my development has been on the older Model B.  Now that this newer Model B G2 is due to arrive any day, I thought I’d clone my B+ and use the image on the G2.

Even though this might seem like a one off, the steps could be used to do a one to many deploy.  This brings back my earlier work developing a video sign for an office.  Getting the base system ready and cloning it out was the last step.  This is huge.  Without this ability, the idea of using the RPi out in the field is not scalable.

Details – lets clone it

First off, let me state that the source media size will need to match the destination media size.  I had attempted to do a backup of a 32GB SD card and restore it to a 8GB SD card.  This may seem obvious, but I feel this needs to be stated.  My reasoning was the actual disk use was 4GB, so it was assumed that it would fit on the new 8GB SD card.  Just keep that in mind.

Now lets start by using a RPi that has been built and configured.  If yours is on, turn it off.  We’ll need to do this before removing the SD memory card.  We’ll be using a Windows machine, so if you’re using a Mac or Linux only, please accept my apologies.  You’re in luck if you have a Mac, found this video…

Insert the SD card into your Windows computer.  Start the Win32DiskImager program. In the “Image File” box, enter the path of the image file you’ll be creating.  Under the “Device” box, select your SD card.  Click the “Read” button to create the image file from your card.  Do be mindful that this will take awhile to complete.  When it’s done creating the image file, you can eject your SD card and put it back in your Raspberry Pi.

The work is done as far as backup goes, you now have an image to use.  This leads us to the next step which is restoring an image.  It’s basically the same thing in reverse with some change ups.

I’ve got a new SD card that I ordered with the new G2 RPi.  This will be a great opportunity to check the image restore procedures.  First we’ll insert the new SD card into the computer.  The drive isn’t quite ready to use yet.  First we need to delete any partitions on it using Disk Manager.  Once that is done, then we can format it so Windows will recognize it.  Now we’re ready to use it in Windows.  Next we’ll start Win32DiskImager.  In the “Image File” box, we’ll select the image we created earlier.  Under the “Device” box, select the SD card.  Click the “Write” button to write the image file to your card.  This can take even longer, depends on the card type.  Plan on doing other things.  After it finishes, you’ll have a ready to use SD card in another RPi.

That’s it!  I suggest you save and save often.  If you’ve been following along, we’ve covered a lot of material.  No sense in losing all that hard work from a bad SD card.  This simple process will save you time and effort.

If you want to see it from start to finish, here is a video…

Relations – how the big players do it

Even though this may seem simplistic, it is fundamentally how large manufacturers accomplish mass deployment.  If you plan to deploy the RPi enmasse, this will be a major part of that effort.  It will allow easier development, debugging, and deployment.

Summary – one to many, many to one

The backup and restore of the RPi involves creating images of the SD memory card.  The process we have defined here makes use of a program called Win32DiskImage that runs only on Windows systems.  We stepped through the procedures to making a backup of the SD card as well as the restore to a separate SD card.  The process can take a considerably long amount of time, so be sure to plan accordingly.

Now that you have the ability to backup, feel at ease making changes to your RPi.

Comments are closed.