Hardware failure is a norm rather than an exception. Like any other hardware, a disk drive also fails, for a variety of reasons, such as power loss, manufacturing faults, usual wear and tear, etc. To recover from any kind of disastrous disk failure, you need to clone or back up your hard drives. For example, dd command is one simple option in Linux environment.
Clonezilla is a feature-rich and user-friendly disk cloning and backup software which is under GPL. Clonezilla provides a convenient interface for cloning a disk/partition to another local device, or archiving a cloned image to an external SSH/Samba/NFS server. You can also run Clonezilla on a standalone DRBL server to clone a large deployment of networked computers simultaneously.
In this tutorial, I will describe how to clone/back up hard drives and restore them with Clonezilla in an end-user environment.
Clonezilla is available as ISO images of Clonezilla live. You can choose between Debian-based and Ubuntu-based ISO images. The latter comes with a more recent kernel and non-free components. To back up hard drives with Clonezilla, you need to prepare a live CD/USB from a Clonezilla ISO image.
Back Up Hard Drives with Clonezilla
Insert a Clonezilla live CD/USB to a computer whose hard drive(s) you want to back up. Change the boot sequence in the BIOS setting of the computer, so that it boots from Clonezilla live media.
Upon power-on, you will see the initial Clonezilla screen as below. Choose "Clonezilla live" option, and proceed.
When asked to choose between starting Clonezilla and entering login shell, start Clonezilla, which will then guide you through via ncurses-based GUI. You can use login shell to perform various administrative tasks on the computer, such as repairing the local file system with fsck, or resetting the root password, etc.
Next, you will see two modes: "device-image" and "device-device" mode. The former mode generates disk/partition images, while the latter mode clones a disk directly to another without creating an image. Here choose "device-image" mode.
Next, decide where a Clonezilla image will be save to. Here I choose a remote SSH server.
Next, configure a primary network interface of the computer.
Next, type in the IP address and your login name of a remote SSH server. Also, specify the absolute path of the directory where Clonezilla image will be saved at the SSH server.
Using the provided SSH server information, Clonezilla will use sshfs to mount the remote SSH server's destination directory locally. Press ENTER to continue.
Next, you will be asked to choose a cloning mode. Choose "Beginner mode" which accept all default options.
In the next screen, decide whether to back up a whole disk or a specific partition in the disk. Here I choose an entire disk (i.e., "savedisk" option).
Next, type in the name of a Clonezilla image to be created.
Use SPACE key to mark the disk to back up. The first disk is named "hda" or "sda", and the second disk is "hdb" or "sdb", etc.
Choose if you want to check/repair the source file system before generating an image. For this option to work, the source file system must be supported by fsck in Linux.
Next, use "check saved image" option if you want to check whether or not an image is restorable after the image is generated.
Finally, Clonezilla will start generating a (compressed) image of a chosen disk drive, and transfer it to a remote SSH server.
You will see the following screen after the image has been successfully generated and verified. Press ENTER to continue.
Now you can either power off the computer, reboot, or start over the same backup procedure for other disk drives/partitions.
Restore Hard Drives with Clonezilla
Restoring a hard drive from an existing Clonezilla image is straightforward. Boot up your computer with Clonezilla CD/USB, and follow the same procedure as above. When you see the following screen below, choose "restoredisk" option to restore a whole disk from the image that was created in the past.
Next, choose a Clonezilla image to restore.
Next, choose a destination local disk.
The rest of the restoration will be taken care of by Clonezilla.
Subscribe to Xmodulo
You can have daily Linux tutorials and FAQs delivered to your email inbox. Simply enter your email address below to subscribe to our mailing list. You will receive hands-on guides and carefully written tutorials related to Linux, everything for free.