Manage partitions and disks with GParted-Clonezilla live CD

9478

Author: Mayank Sharma

Backing up partitions and hard disks sounds like work — until you’ve tried Clonezilla. With Clonezilla you can clone and duplicate partitions of various formats and disks of various sizes locally or over the network. Even more impressive is the fact that you can do all this without typing complicated commands. And since Clonezilla is available as part of the GParted-Clonezilla live CD, you don’t even have to install it.

Most desktop users don’t back up disks or partitions day in and day out. But once in a while you may manage to exhaust free disk space on a partition. If it’s surrounded by another partition, you can either move it to another disk or to another area of the same disk that has free disk space around it, but that’s easier said than done.

While system administrators may take such problems in stride, for most desktop users this situation is like a punch in the face. After breaking into a sweat and Googling for an easy solution, they may spend a couple of hours backing up most of the data to removable drives, repartitioning the drive, reinstalling the distro, and restoring the data. But there’s an easier solution.

The GParted-Clonezilla live CD is available as a 131.5MB minimal distro based on Gentoo-catalyst, and uses the Xorg X server, the lightweight Fluxbox window manager, and a modified 2.6-series Linux kernel. Because of its small size, the live CD will work comfortably on machines equipped with a Celereon 500MHz processor or better.

The live CD includes both Clonezilla and the GParted partition editor. The GParted tool helps you resize partitions by gobbling free space. It assists in reorganizing a disk once a partition has been backed up. Additionally, GParted can also delete existing partitions and make new ones, or convert one type of partition into another.

GParted works with several types of partitions including ext2/3, FAT 16/32, NTFS, ReiserFS, and JFS. Using GParted isn’t difficult if you know what you’re doing. For that, read the detailed and illustrated documentation and our review from last year. Recent versions of GParted can now expand to free space that’s available before a partition, but there’s still no help available from inside the application.

What’s Clonezilla?

According to its homepage, Clonezilla is a GPL-licensed cloning system much like the proprietary Norton Ghost and the open source Partimage. But unlike these applications, Clonezilla emphasizes cloning many disks simultaneously. To do this it needs you to make a couple of changes in your existing setup, like providing a Diskless Remote Boot in Linux (DRBL) server and enabling all computers to boot over the network.

But for occasional emergencies at home or a small office, you can forgo setting up a dedicated server and instead use the live CD to hop from one machine to another, backing up and restoring partitions. Even from the live CD you can use Clonezilla to back up and restore individual or multiple partitions or complete disks to local disks or to external USB storage, or over the network via Samba and SSH.

Another benefit of using Clonezilla is that for filesystems it supports (ext2/3, ReiserFS, XFS, JFS, FAT, NTFS), it saves only blocks that are in use instead of backing up the complete partition or disk. This not only makes the cloning and restoring process faster but also results in smaller backups.

Booting the live CD

The GParted-Clonezilla live CD is packaged and distributed by the GParted project. The Clonezilla project has a Clonezilla-only live CD as well. For this article, I used the latest version of the GParted-Clonezilla live CD, v1.9.

When you download the GParted-Clonezilla live CD, burn it onto a CD, and boot, you’ll notice its GRUB screen lists some 23 boot options. The first 11 options help you run GParted with all types of hardware, from Apple MacBooks to Hewlett-Packard laptops. For most users, the default first option should work.

The next five options concern Clonezilla. Using these options you can copy Clonezilla to RAM and free the CD or DVD drive, or run it with minimum options to make it run in any environment. Again, the default option to simply run Clonezilla should work for most users. The last seven options let you skip booting either GParted or Clonezilla, instead passing control over to an operating system installed on the disks.

Using Clonezilla to clone partitions and disks

When you boot Clonezilla, it asks you basic questions about setting up the language and keyboard layout. Select the default options to keep English and the US keyboard layout. Next, the boot process asks whether you’d like to run Clonezilla from the command line. Unless you are an experienced Clonezilla user, select the option to “Start_Clonezilla” instead of being dropped to the shell.

Now comes the first question that’s going to have an effect on your backup. You have to select where the directory with your backup image will be stored. The options presented include a local drive, an SSH server, or a Samba server. If you choose to mount a local drive, the next screen lists the partitions available on the local disks, including partitions on any USB drives attached to the computer. Needless to say, make sure you don’t select the partition you want to back up! If instead of mounting a local drive you choose to mount a remote partition over Samba or SSH, Clonezilla will ask for relevant connection information, such as server name or IP address, username, and password.

Once you’ve selected a partition, either local or remote, Clonezilla will mount it and display its disk space usage, then display a screen with four options — save disk, restore disk, save parts, and restore parts. Irrespective of what save option you select, you’re next presented with four advanced Clonezilla parameters. Most of the time you can use the default options, which will use ntfsclone to clone NTFS partitions and will make Clonezilla wait for your approval before cloning.

Next you select from among four compression methods that offer a different balance between speed and size. The first option makes clones the fastest because it doesn’t compress them at all. The second option uses gzip, the third uses bzip2 to create the smallest images but takes longer to complete, and the last option uses the LZO compression algorithm with gzip to create faster clones. This is the default selection.

The penultimate step is to choose the name of the folder that’ll house the clones. By default Clonezilla names that folder according to the current date and time. Finally, select the disk or the partitions to clone from the ones listed. Clonezilla lists only unmounted partitions; if you don’t see the partition you want to back up in this list, chances are that you have accidentally selected it as the partition, or the drive it resides in, to store your backup. If this is the case, you’ll have to quit Clonezilla and start again.

That’s it as far as cloning is concerned. If you asked Clonezilla to confirm before cloning, it’ll prompt you whether it should proceed. Depending on the size of the partition and the compression method, the cloning process can take some time. I backed up an entire disk with three partitions, one FAT32, one ext3, and one swap, totaling just 2.3GB. Clonezilla cloned the whole disk onto a USB 2.0 drive in about 9 minutes, and using the default compression method squeezed it to less than 950MB.

Restoring partitions and disks

Once you’ve backed up partitions, you can use GParted and alter the disk or prepare a new one. Since using GParted is already well documented, I’ll not repeat the steps here. Once you have prepared the disks, you can restore the partitions.

The process of restoring cloned partitions or disks, isn’t much different from cloning them. You again begin by answering the language and keyboard questions. But instead of selecting resources to save the clone to, you select the local or network resource to restore the cloned image from.

When you select the partition or disk to restore from, Clonezilla presents you with a list of 13 parameters, including the option to reinstall the contents of the master boot record, if you choose to restore disks. While Clonezilla did recreate my disk as it was, it couldn’t reinstall the LILO boot loader my old Knoppix 3.7 distro was using. Same story with GRUB. Unless I cloned and restored a complete disk, my boot loader wasn’t restored properly. But you can easily add a boot loader to a disk using any live rescue CD.

The real benefit of Clonezilla becomes apparent when you restore individual partitions. If you have a partition that is almost full and surrounded by other partitions — say a 1GB sda1 — first clone it, then move to another disk and create a larger 20GB sda1 partition using GParted. Or, after cloning, use GParted to grow the partition following sda1, to use the freed up space, and create an sda1 partition at the end of the disk. Now use Clonezilla to restore the old 1GB sda1 partition on this new 20GB sda1 target partition. Once the process is complete you’ll have moved whatever was on your 1GB partition into bigger real estate on the same or another disk. Just remember to select the “Do not create partition in target hard disk in client” option from the advanced parameters listed while restoring the partition. If you forget, Clonezilla will resize the 20GB partition to the original 1GB size.

Conclusion

For a home user or an administrator with just a few systems, the GParted-Clonezilla live CD is an excellent tool for managing disks. It can save you several hours when preparing new disks or migrating partitions from one disk to another. It’s also a fantastic way to move a partition that’s not around free space into a bigger partition without much fuss.

But bear in mind that both GParted and Clonezilla are dangerous utilities. To get comfortable with them, consider trying them out on a virtual machine with virtual disks and virtual partitions and no critical data. Unless you want to simply duplicate partitions or disks, you’ll need to play with the advanced parameters. Because the Clonezilla project makes virtually no documentation available, I also suggest you make a cheat sheet for yourself as you go along using the app, listing the advanced parameters to choose for particular operations. This is useful if you regularly need to repeat a particular type of partitioning task, such as cloning partitions and moving them to bigger ones on another disk.

Categories:

  • Tools & Utilities
  • System Administration