[easyreview title=”Complexity rating” icon=”geek” cat1title=”Level of experience required, to follow this how-to.” cat1detail=”This is wizard-driven. Very simple. You’ll need to be able to burn a CD, nothing more taxing than that.” cat1rating=”1″ overall=”false”]
Contents
- Part 1: Getting started with the Raspberry Pi
- Part 2: Creating/restoring an image of the Pi’s SD card
- Coming up – Part 3: Using the Raspbery Pi to host multiple web sites and as a file server
- Coming up – Part 4: Creating a Dropbox replacement from a Raspberry Pi
- Coming up – Part 5: Using a Raspberry Pi as a thin (or remote desktop) client
In my last Raspberry Pi tutorial (the first in this series), I mentioned that we can take a snapshot of the Raspberry Pi’s SD card at any time. This will give us a “restore point”, so we can skip a few installation steps if we want to wipe the Pi and start again. Quite a few Raspberry Pi projects will require that we start with a working installation of Raspbian so that’s the snapshot I’m going to take. You can of course take a snapshot whenever you like. If you’ve honed and polished your Rasbmc box, it would make sense to take a snapshot in case it becomes horribly corrupted at some point or melts.
There are many different ways of skinning this cat (or squashing this ‘berry), but my preferred method is the tried and tested customised Linux distribution, Clonezilla. I’ve been using CloneZilla personally and professionally for years and persuaded many colleagues of its merits (besides the obvious, that it’s free). It can be a bit intimidating with all the options it presents. If this is your first experience of CloneZilla, following this tutorial will also give you a gentle introduction to this powerful toolkit.
What you’ll need
- A copy of Clonezilla, burned to disc.
- A computer (desktop or laptop) configured to boot from CD.
- An external hard drive, with enough space to store the image (you’ll only need a few gigabytes spare).
- A USB reader for your SD card. You can buy one here.
Take a snapshot
- Power down your Pi, with the command
halt
,shutdown
orpoweroff
. - Boot your PC from the Clonezilla disc. You will arrive at a simple menu/boot screen. It will boot automatically within 30 seconds – you can hit enter at any time, to proceed.
- You’ll be treated to rows and rows of gibberish while Clonezilla boots up.
- Choose your language and keyboard setting.
- Hit enter to start Clonezilla (yeah, you thought it had already started, didn’t you).
- Insert your Raspberry Pi’s card, in its reader.
- Choose “local_dev”.
- A screen prompt will tell you to insert your external hard drive.
- Insert the external drive and then wait for 5 seconds or so.
- A few lines will indicate that Clonezilla has registered the presence of the drive.
- Hit enter and Clonezilla will mount the various partitions now available to it.
- Select the external hard drive as the drive to which we’re copying the snapshot (in my case, the largest partition on the list).
- Hit enter. If the drive wasn’t cleanly dismounted before (oopsie), Clonezilla will check and fix as required.
- Choose a directory to store the SD card image and hit enter.
- Clonezilla will spit some more gibberish at you. Ignore it and hit enter.
- Though it makes me feel a little silly, choose Beginner mode.
- Choose “savedisk”.
- Give your disk image a meaningful name.
- Select the SD card, to save the image. You use cursor keys and the space bar here.
- Select Ok to continue.
- If you’re confident your SD card is in good shape, you can skip checking it.
- I’d recommend checking the saved image though. It doesn’t take long and gives you peace of mind that you should be able to restore from this image.
- Clonezilla will helpfully point out that you can do all this from the command line (yeah, right).
- Press Y and enter to continue.
- Shouldn’t take too long.
- When it’s all done, it’ll report progress. Press enter.
- Enter 0 to power off (or whatever you prefer) followed by enter.
- Clonezilla will eject the disc. Hit enter to carry on.
You should now have an image (consisting of several files) on your external hard drive, which you can later use for restoration. Job done.
Restore a snapshot
In this scenario, we’re starting with everything powered off, ready to begin.
- Boot your PC from the Clonezilla disc. You will arrive at a simple menu/boot screen. It will boot automatically within 30 seconds – you can hit enter at any time, to proceed.
- I’ve got to say, this screen full of strange foreign characters is pretty unnerving. But don’t worry. It’ll pass.
- Choose your language.
- I’ve never found I’ve had keyboard problems, even though I use a UK keyboard…
- Hit enter to begin.
- Insert the SD card/reader. Some nonsense will appear on screen. Don’t worry – just hit enter.
- Select “local_dev” and hit enter.
- Insert your external hard drive and wait 5 seconds or so for it to be recognised.
- It’ll detect the drive – hit enter.
- Next, it will mount your various partitions.
- You may have a few…
- Choose the external drive from the list then hit enter.
- Clonezilla will check the drive.
- Choose the directory where your saved image is stored and hit enter.
- Clonezilla will give you an overview of its file systems. You will be thrilled. Hit enter.
- Choose “Beginner”, no matter how patronised you may feel.
- Choose “restoredisk”.
- Select the previously saved image.
- Choose the SD card. Hit enter.
- Clonezilla reckons you really want to do this at the command line. Hit enter.
- This is a destructive operation and will wipe your SD card. Press Y then enter.
- Clonezilla doesn’t trust your judgment. Hit Y and enter again.
- There are two partitions to restore to this card. You’ll get a progress report for each restoration.
- Clonezilla will let you know once it’s done.
- Press enter to continue.
- Choose 1 to reboot (or whatever you prefer) then hit enter.
- Once the CD is ejected, you can also disconnect the SD card and hard drive. Hit enter.
- Witness the majesty of the Linux death rattle.
If all went well, you can now install this SD card back in your Pi, boot up and continue.