I mentioned previously that I've begun taking regular offline backups of my system with the help of a piece of software called Clonezilla. Since Cryptolocker continues to see media coverage and shows no indications of slowing down, I wanted to take some time to outline what Clonezilla is and how I'm using it. In particular, I'm going to detail the steps I took to set up my current configuration, because I couldn't find much on the Internet that covered the specific idea I had in mind for my backup drive.

Clonezilla in a nutshell

Clonezilla is a free and open source disk/partitioning imaging program, and I'm using it for my backups for a variety of reasons. The benefit in taking a full disk image, as I see it, is that if you end up facing some kind of catastrophic failure (either software or mechanical), you can restore not only all of your files but also your operating system, your settings, etc. The disk image that Clonezilla creates is simply a carbon-copy of everything on your drive, even down to the partition tables and layouts.

There are other pieces of software that serve similar purposes, such as Norton's Ghost and Acronis's True Image. Sometimes you can even get a copy of these paid programs as a little bundle deal when you buy a hard drive, the idea being that you can then use the shiny new drive with the imaging software for backups or to migrate your system to a larger drive. I find Clonezilla to be very robust for a free solution, though, and I definitely recommend it if you don't want to shell out the cash for imaging software, or if you're not sure if this style of backup is going to really work for you.

Typically, when using Clonezilla, you need to first create some kind of boot media. This can be a CD/DVD, a USB flash drive, an SD card, or whatever else your computer is capable of booting from. On older machines you may need to look at your computer's (or motherboard's) manual in order to see what boot methods it supports. Once you boot up Clonezilla, it will ask you to set up some basic options, like which drive you want to backup, where you want to write the backup, and how you want it stored. You can use compressed images or raw ones, and most of these choices are basically matters of personal preference. I'm personally fond of using raw images because my external drive has plenty of space, and I can mount them as virtual disks if I ever want to access the data piecemeal.

The all-in-one backup drive

So having a new 2 TB drive in hand and a Clonezilla ISO, I was curious if I could make the whole thing work without needing a separate piece of media from which to boot Clonezilla. I took to the Internet in the hopes of finding someone who had accomplished the same feat, but most of my results came up with very little information. Since the concept seemed very straightforward, I decided to give it a shot on my own, and the process ended up working out quite nicely.

What you'll need:

  1. A copy of Clonezilla, which you can get from the downloads page. I'm using the Ubuntu-based variant (built on Raring Ringtail, Ubuntu 13.04).
  2. An external hard drive that is larger than your computer's current drive. I snagged a 2 TB Western Digital one from Best Buy for a (surprisingly) reasonable price to complement my 750 GB laptop drive.
  3. A disk partitioning utility. On Windows I use EaseUS Partition Manager, but you could probably try the Disk Management software that comes with Windows (I find EaseUS faster and more robust). On Linux I generally use GParted.
  4. Some way to write the Clonezilla image to your drive. Clonezilla actually maintains a list of tools for this.

Step 1: Partition the external drive

The first thing you need to do is divide your external drive into two partitions. The first will be a FAT32 partition where you'll install Clonezilla, and the second will be for your backups and can be (more or less) whatever filesystem you'd like. If you're using Windows and may need to access the images from your laptop, NTFS is probably the best option. On Linux systems, ext4 is pretty much the obvious choice (unless you're using something slightly more exotic, like btrfs). Make sure the FAT32 partition is first on the disk, and make sure that you mark it as "active" or "bootable". Also make sure that it will be large enough for Clonezilla to be installed; 250 MB is probably a decent enough size, and is what I ended up using.

Step 2: Install Clonezilla

Next you'll need to get Clonezilla on your USB drive. You can basically follow the documentation for this part (linked above in item 4). The gist of it is that you should fire up your live USB creator, then tell it to write the Clonezilla ISO file to your external drive's first partition. Again, make sure it's the first partition, the one that you formatted as FAT32.

Step 3: Reboot into Clonezilla

Reboot your computer with your USB drive plugged in to one of the available ports. Depending on your motherboard, you may need to press a key during boot up (before your OS loads) in order to access your boot menu and select the external drive. On many computers this will be something like F11. You could also go into your BIOS and set USB as first in the boot order, so that you won't need to it manually.

When Clonezilla first boots, it will take you to GRUB, a bootloader menu. From there you want to choose Other modes of Clonezilla live, followed by Clonezilla live (to RAM...). There are screenshots of this in Clonezilla's documentation. The reason we're doing this is because it ensures that the entire external drive will be free for use while Clonezilla is running.

Step 4: A little tweaking

By this point, everything should hopefully have gone smoothly. However, here is where I hit one little snag in the whole process. I found that while Clonezilla would recognize the external drive was plugged in, I could not select the second partition when choosing where I wanted my backups to be stored.

The solution I found required a little bit of manual work, but it is really very simple. After selecting your keyboard layout, Clonezilla will present a very simple menu with two choices:

  • Start Clonezilla
  • Enter Shell

Select the second choice followed by "cmd prompt" and you'll be presented with a Linux shell. All you need to do is manually mount your external drive's partition, then kick off the clone as usual. In my case - and in most situations, unless you have multiple drives in your computer - the external drive was set as sdb, so the partition I needed was sdb2. The mount point you need to use is /home/partimag, so the commands were:

[email protected]:~$ sudo su
[email protected]:/home/user# mount -t ntfs /dev/sdb2 /home/partimag
[email protected]:/home/user# clonezilla

From there you should be able to run the clone as normal, using the "device-image" option.

Step 5: Profit!

Cloning my laptop took a little shy of 4 hours, but if you let it run overnight you can tell Clonezilla to shut down your machine when it finishes. Once it's done you can unplug the drive and stash it somewhere safe until you're ready to take your next backup or you need to restore. The main benefit to doing everything on one drive this way is that now I no longer have to worry about losing my Clonezilla boot media. I need the external drive to do the clone anyway, so by installing Clonezilla directly to the drive I only have to deal with one piece of equipment for my backups.