Clonezilla is a free and open source disk imaging and cloning utility. It can be run either from a bootable CD/USB disk (Clonezilla Live) for an individual computer, or from a server (Clonezilla SE) for cloning multiple computers across a network. It’s a sophisticated disk imaging tool which uses some powerful and long established Linux utilities under the hood – eCryptfs for encryption, gzip/bzip2 for compression, and ntfsclone/dd for cloning, as well Clonezilla’s own partclone utility. Its strong points are the robustness of the Clonezilla itself (as well as the underlying utilities), support for a wide range of file systems, and that it doesn’t alter the disk being imaged. It lacks incremental/differential backups, and user friendly automated backups, so you might want to look at other tools if this is a concern. However, even if you use another program for regular automated backups, you may still want to create Clonezilla backups occasionally for the peace of mind you get from a robust and widely used open source tool.
Creating a System Image with Clonezilla Live
The simplest way to run Clonezilla Live is from a USB disk. Clonezilla is available to download in two stable releases. The default release runs on Debian Linux and an alternative version runs on Ubuntu. Here I am using the Ubuntu version due to better support for drivers at the time. Just select the architecture (typically amd64) and download as an ISO file. There are a few ways to create a bootable USB drive with an ISO file, some more difficult than others. One of the easier options is to use a dedicated utility like Rufus. To create the bootable Clonezilla disk in Rufus, check Create a bootable disk using ISO image and browse to the path of the downloaded Clonezilla ISO file, then click Start.
Once the bootable Clonezilla Live disk is created, reboot the computer and hit F12 when the initial boot screen appears, and boot from USB storage. This will boot directly to Clonezilla live instead of normal operating system boot.
Before Clonezilla starts, it gives the option to select a different language (set to English by default), and keyboard layout. When starting Clonezilla, there is also the option to start from command line prompt instead, which will drop the user to a Debian or Ubuntu terminal, depending on which Clonezilla release is being used.
Disk Imaging or Cloning
The next step is to choose device-image or device-device mode. device-image (the default option) is for creating disk images, whereas device-device is for cloning one physical disk to another. Here we are using device-image as we are mainly interested in creating disk image backups.
Backup Location
Select where to save the disk image. Images can be saved to a local disk, networked disk via SSH, Samba, NFS – or alternatively on Amazon S3 storage service. In this example, I am saving to a network disk (NAS) using Samba/CIFS.
In order for network based backup to work, the network interface needs to be set up. If DHCP is running on local router, choose this option, and in the next step enter the IP address of the NAS device.
Clonezilla will then prompt for the Samba user and share names, and will drop to the command line to prompt for a password to mount the Samba share.
If it successfully mounts the network share, it will list it together with other mount points as /home/partimag by default.
Imaging Options
At this point, it’s time to configure the actual imaging (or cloning) operation. There is a choice of beginner mode (with less options to keep it simple) or expert mode.
The next page lists the imaging options. The two most important options are savedisk for creating a new disk image, and restoredisk for restoring an existing backup image.
Choose savedisk to setup a disk image backup. This will prompt for an image name, selecting a default name based on the date.
Now select the disk to be backed up. For majority of use cases there will only be a single disk to choose from.
Imaging Utilities
Clonezilla offers a choice of cloning/imaging utilities. The default cloning tool is partclone, which was created by the Clonezilla developers. The other options are partimage, ntfsclone and dd. Partimage is an older Linux cloning utility (with experimental support for Windows NTFS file system) but it is no longer actively maintained, so probably no longer a good option. Ntfsclone is a Linux utility for cloning NTFS file systems, and is a good option for imaging a Windows disk or partition. dd is a longstanding Linux command line utility for converting and copying files. It is only recommended for file systems that are not supported by other utilities, since it will do a sector by sector copy, which is very slow (i.e. it will even copy sectors on the hard disk which have no data). It’s usually best to stick with the default imaging option (partclone). Partclone has support for a wide range of file systems – ext2/3/4, ReiserFS, XFS, JFS, HFS+ for Mac OS, as well as NTFS and FAT for Windows. Normally it is advisable to use partclone over ntfsclone when imaging NTFS file systems, since it stores checksum information (to allow subsequent data integrity checks), and displays terminal output, so provides more information when running.
When choosing the cloning program, Clonezilla provides a list of options in priority order, where it will try the first program, and then move onto the next program until it finds a program which is supported for the file system to be cloned. If partclone is chosen, it will use this in most cases, since partclone supports many file systems.
Advanced Options
If expert mode is chosen, there are some extra options in savedisk imaging setup. The space key is used to select non-default options. Normally these options can be left at the default. A couple of options might be of interest. The –nogui switch which will offers some speed improvements during imaging operation since it doesn’t spend resources calculating time remaining. The –rm-win-swap-hib is recommended for Windows systems, as it excludes the swap and hibernation files from the backup. There isn’t really a benefit to backing up these files, so not sure why it’s not enabled by default.
Compression
Clonezilla offers an unusually large selection of data compression options. It uses the following Linux compression utilities under the hood – GZIP, BZIP2, LZO, LZMA, XZ, LZIP and LRZIP. If in doubt, just pick the default one (GZIP). As far as compression goes, most use cases typically call for a sensible balance between speed and reduced data size, which GZIP offers. As a rough guideline, if you would like compression to be ~4x faster but are ok with the compressed data being ~50% larger, LZO is a good option. If you want compressed data to be ~30% smaller but are ok with it being at least 4x slower, then XZ or LZMA are good options.
File Splitting
By default, Clonezilla splits backup image data into 4GB files. It’s probably best to leave it at the default since this is the most widely tested for data integrity. However, it’s possible to avoid file splitting by entering a very large number (i.e. larger than the data on the disk being copied).
File System Check
Clonezilla can run the fsck (file system check) utility on Linux file systems before running the backup. This is probably a good idea when creating a Linux disk image, but is not available for Windows since it does not work on NTFS filesystems.
Once the disk image has been saved to the backup location, a check can be run to make sure it is restorable. This takes a long time but is a good idea, especially if only creating disk image backups very occasionally. It works by generating checksums from the copied data and comparing them with the originals. Generating checksums requires re-reading each bit of copied data, which is why it takes a long time.
Encryption
Encryption is available with the eCryptfs utility. eCryptfs is open source, which is always a good thing for encryption, as it allows peer review. It offers a choice of encryption algorithms, although it’s set to 256 bit AES in Clonezilla setup, similar to other imaging software. eCryptfs is a well-respected encryption utility in the IT security community. It is used in Ubuntu’s encrypted home directory, and in Google’s ChromeOS. The developers behind eCryptfs have worked with IBM linux technology center for its initial development, Microsoft (working on BitLocker encryption), and Canonical which is the company behind Ubuntu (working in Ubuntu’s security team).
When encryption is chosen as an option in Clonezilla, the user will be prompted to enter a passphrase twice directly before disk imaging begins.
Confirm Setup
When the disk imaging setup is complete, Clonezilla shows the command line equivalent to all the options chosen, and the mount point destination where the imaged data will be saved.
Partclone Imaging
Once the savedisk setup process is complete, the partclone UI appears (if partclone was chosen for imaging). It shows Data Block and Total Block progress bars to indicate the progress of the backup for blocks with data, and for all blocks on the disk. Partclone initially calculates a bit map, where it maps out which block on the disk have data on them.
Once the actual clone/copy is complete, it checks the image (unless this feature is disabled during setup). It compares the checksums on the destination to those generated on the source. This step typically takes a long time.
Once the image check is complete, the backup is complete, and Clonezilla displays a text output confirming the newly created image is restorable.
There is then an option to re-run Clonezilla or power off.
Restoring a Backup Image
To restore an existing backup disk image, select restoredisk in Clonezilla UI.
It will list available images for restore, from the backup destination specified during setup.
Next choose the target disk to overwrite.
Clonezilla will then launch partclone, which checks the image is restorable as a first step. Then partclone will run the actual restore.
Automated Setup
It’s possible to automate the Clonezilla live setup to create or restore a disk image backup. However, this is best suited to people who are comfortable with using Linux from the command line, since it requires manually editing configuration files and debugging errors from the command line if there are issues.
There are two config files in the syslinux directory in Clonezilla live. If booting from a USB drive, one should edit syslinux/syslinux.cfg, and if booting from a CD/DVD, use syslinux/isolinux.cfg. This config file should be edited to add all the steps normally done manually from the Clonezilla GUI, as command line options.
To set language and keyboard.
locales=en_US.UTF-8 keyboard-layouts=NONE
To run Clonezilla in batch mode.
ocs_live_batch=”yes”
To set up a network drive.
ocs_prerun1=”dhclient –v eth0” ocs_prerun2=”mount –t cifs –o user=XXX, password=XXX //192.168.x.x//home/partimag”
For other settings (e.g. compression/encryption), take a look at the command output when running Clonezilla manually. For example, the manual setup outlined in the previous section results in the command below.
ocs-sr –q2 –c –j2 –z1 –i 4096 –p true savedisk 2016-04-08-08-img sda
Further details are available in the Clonezila documentation, but attempting to set up Clonezilla in batch mode is probably best attempted if you already familiar with Linux administration.
Disk Cloning
To clone a hard disk directly onto another physical hard disk, choose device-device instead of device-image in the setup.
This gives the option to clone a disk or partition to a local or remote disk or partition.
Then select the source disk to clone from.
Finally choose the destination disk to clone to, making sure to pick the right one to avoid losing data.
While Clonezilla doesn’t explicitly allow cloning to a disk which is smaller than the source disk, newer versions of Windows have a Disk Management utility which allows partitions to be shrunk down if there is free space. So when cloning a Windows system, go to:
Control Panel -> Administrative Tools -> Computer Management
Then in Computer Management window, go to:
Storage -> Disk Management
Right click on the main partition and select Shrink Volume.
After shrinking the main partition, restart and boot into Clonezilla and run a partition to local partition clone instead of a disk clone.
Clonezilla Pros and Cons
A major difference between Clonezilla and other popular disk imaging software is that it runs from a bootable Linux distribution, rather than natively from Windows (or other installed OS). This means Clonezilla is not accessible from the native OS, and can’t be easily scheduled to run on a frequent basis. So understandably, there is no option to backup a disk when the native OS is currently running. For casual users, it’s very much a manual tool, where one has to click through multiple screens and manually configure the backup target disk each time Clonezilla is run. Automated setup requires editing the config script in the bootable setup, and still requires leaving the native OS to access Clonezilla. On the plus side, people who are comfortable with editing options in config files, and working from the Linux terminal, will find this extra flexibility very powerful.
While it is less user friendly than other imaging tools that run in the native OS, it is particularly robust and trustworthy, given it’s one of the most widely used imaging tools for both Windows and Linux, being heavily used by IT administrators, since it also offers powerful functionality to automate backup and restore across a network. Since the majority of admins work a lot from the command line and scripts, this is seen as a strength rather than a limitation. Clonezilla uses a lot of industry standard open source command line Linux utilities under the hood. Since these utilities are widely used and many have been actively developed for a long time, it gives a lot of confidence that backup images will be restorable without corruption when needed.
Notably lacking in Clonezilla are incremental and differential backups. Incremental backups can save a large amount of disk space when running frequent backups, so this is an important feature. If running frequent disk image backups is a requirement, one option is to use a different imaging tool for frequent backups, and occasionally run Clonezilla to have a robust second set of backups.
Also lacking is the ability to exclude files and folders from a backup, which is useful when personal data is backed up elsewhere. It does have the ability to exclude the Windows swap and hibernation files, so hopefully this functionality will be expanded at some point.
Clonezilla doesn’t natively allow backup images to be mounted to recover individual files. This is a very useful feature so it’s a pity it’s not available. There are some workarounds available to do this, so hopefully it will be properly supported at some point.
An unusually large number of file systems are supported, which is great for Linux and Mac users. There are also an impressive number of compression options available, which is helpful when trying to save disk space or maximise the backup speed. Also notable is the use of eCryptfs, which is a very trustworthy encryption utility, so is an excellent choice for anyone concerned about data security.
Summary
Clonezilla is a free and very popular disk imaging program. It is particularly robust since much of its functionality is built on widely used and well tested Linux utilities. It’s unusual in that it runs from a bootable disk, rather than being natively installed in the OS. Clonezilla requires a lot of manual interaction for a novice user, but has powerful automation options available with some effort. Notably absent features are incremental/differential backup and file exclusion. For this reason, it is probably best suited for less frequent use.
Clonezilla is particularly trustworthy for backup data integrity, is well suited to scripted automation, and its support for a large number of file systems means it is works well for Windows, Mac and Linux backup alike.