In this guide I'll show you how to clone and restore an entire storage drive from a computer, like your Proxmox VE host, with one of the most popular tool out there capable of doing so: Clonezilla.
I'll demonstrate the procedures with a VirtualBox VM I've setup with two "internal" storage drives (with fixed sizes), to remind you of the internal storage setup in the Proxmox VE host used in this guide series.
To clone a storage drive in a computer, you need to boot up the system with Clonezilla Live. So first you need to download and install it in an USB drive, like you did with the Proxmox VE installer back in the G002 guide.
-
Download the latest stable version of Clonezilla Live from this page. Choose the alternative stable edition, since that one is based on Ubuntu and will have better hardware support. In this guide I'll use the
20210609-hirsute
stable version of Clonezilla.- Clonezilla's download page will ask you three things.
- CPU architecture: choose
amd64
if your computer has a 64 bits CPU. This architecture is also necessary for systems with uEFI secure boot enabled. - File type: choose
iso
to download Clonezilla Live as an iso file. - Repository: leave
auto
, so the page can determine on its own from where it should download the requested iso file.
- CPU architecture: choose
- Clonezilla's download page will ask you three things.
-
Prepare an empty USB drive, a 4 GiB one should be enough. Be sure that it's empty, since this is the device where you'll flash the Clonezilla Live iso.
-
Flash the Clonezilla Live iso into your USB drive. If you're on Windows, you can use Rufus (as I showed you in the G002 guide), balenaEtcher or any other program you might prefer. If you need more references, check out this Clonezilla Live page where they give more details about different methods for flashing the iso on different OSes.
With Clonezilla flashed in an USB drive, you can start creating images of the storage drives in your computer.
-
Ready a large external (USB) storage drive, one where your Clonezilla images can fit. Clonezilla supports many filesystem formats so, for instance, you could use a ntfs-formatted storage to save the Clonezilla images.
- Furthermore, you could prepare beforehand some directory structure to organize the images within that storage drive. Be mindful that you won't be able to create folders from within Clonezilla, only choose where you want to store the images.
-
Boot your system with your Clonezilla Live USB. You'll reach its GRUB boot menu.
From the several
Clonezilla live
options shown, choose the one that fits better your screen. In my case, I'll stick with the default(VGA 800x600)
one. -
After a few seconds, you'll see a language menu.
Just choose your preferred language and press enter.
-
Next you'll reach the keyboard layout menu.
If the automatically chosen layout doesn't fit your needs, choose
Change keyboard layout
to change it. -
The following screen makes you choose between starting Clonezilla or getting into a shell.
Leave selected the
Start Clonezilla
option and press enter (or clickOk
with your mouse). -
You'll get to the Clonezilla main actions menu screen.
To clone images out of your storage drives, keep the action already highlighted first,
device-image
, and press enter. -
Next, Clonezilla will ask you on what kind of storage device you want to store the image in.
In this case, you'll be using a local device as storage drive, so leave the already chosen
local_dev
option. -
Clonezilla will print some lines warning you to plug in the USB drive in which you want to store the image.
If you didn't already, plug your USB storage now and wait a few seconds to allow Clonezilla detect it. Then press enter.
-
Next you'll see the autoscan output (which refreshes every few seconds) of what Clonezilla is detecting as local storage devices.
Above you can see how it sees three storage devices:
/dev/sda
is the first storage device in this computer./dev/sdb
is the second storage device./dev/sdc
is the external USB drive you want to use for saving Clonezilla images.
With your USB drive detected, you can get out of this screen by pressing
Ctrl+C
. -
You'll get into a screen where you'll have to choose a partition from the ones found within all the previously detected local storage devices.
BEWARE!
Be careful of not choosing any partition within the drive you want to backup. Only choose a partition present in your USB storage drive (thesdc
drive in this case).Choose the partition that corresponds to your USB drive, which would be
sdc1
in this case.If there's more than one partition available in your external USB storage, be mindful of which one you're using as repository for your Clonezilla images.
-
After choosing the partition, you'll be asked if you want to check the filesystem within the chosen partition.
Let's trust your USB drive and just skip the check, so keep the
no-fsck
option highlighted and press enter. -
You'll reach the directory browser screen, where you have to choose the directory (within the partition you selected previously) in which you want to save the image.
The USB drive I'm using here is an empty ntfs formatted one, which explains the Windows recycle bin folder. Notice that Clonezilla here doesn't give you any option for handling directories, you can only choose the one you want.
BEWARE!
Don't be confused, the$RECYCLE.BIN
item in the snapshot above is not the selected directory. The currently selected one is the '/
' one, the root of the partition you chose previously as your images' repository.Pay attention to the
Current selected dir name
line, it indicates you in which path you are.Browse
inside the directory you want to use as Clonezilla's image repository and then pressDone
(with the mouse, if you like). -
Clonezilla will print some lines confirming your selection.
BEWARE!
Don't be confused, the$RECYCLE.BIN
item in the snapshot above is not the selected directory. The selected one is the '/
' one, inside of which the$RECYCLE.BIN
lays.The path under the
TARGET
column, the/home/partimag
is the path in memory where Clonezilla has mounted the partition you chose previously. Press enter to allow Clonezilla to continue with the cloning. -
Now that you know where you want to save your image, the next step is to choose how you want it to be cloned. The operation mode is something you select at the screen below.
Stick to the
Beginnger mode
option, since it should be enough for your needs. -
Clonezilla will ask you if you want to make an image of the entire disk, or save each of its partitions as independent images.
In this case you want the image of the entire disk, so leave the
savedisk
option selected and press enter. -
You'll be asked a name for the image you're going to create.
BEWARE!
Don't use spaces in the filename.Give all your images meaningful filenames, to make their management easier.
BEWARE!
The only thing that tells apart one image from another is their name, so always try to apply a proper naming scheme to your images. For instance, it could be<hostname>_<device name>_<current date>_img
.
Also, be careful of not making the name too long or it won't fit when listed by Clonezilla.Since I want to clone the
sda
drive in the image, I've named the image related to the targeted storage drive. -
In the following screen, Clonezilla asks you which disks you want to clone.
Notice that you could choose all the disks in the list and clone them all in the same image. This possibility can be useful in some cases but, for our scenario, a one-by-one method is more convenient. So, choose only the one disk you want to clone and press enter. Given the name I set for the image in the previous step, you know is the
sda
one this time.Notice the '
*
' marking the selected drive. -
Clonezilla also needs to know which compression method you prefer.
Unless you think your system cannot handle it, keep the
parallel gzip compression
option highlighted and press enter. -
You'll be asked about checking the
source filesystem
, meaning if you want Clonezilla to look for errors in the filesystem of the drive you're about to clone.Unless you have some suspicion that the filesystem within the disk you're about to clone is faulty, skip the check by keeping the default
-sfsck
option selected and press enter. -
Clonezilla also has the capacity of checking the resulting image to verify if it's truly restorable. This screen asks you about if you want the check be executed when the cloning is done.
Leave the default
Yes
option and press enter. -
The next screen you'll see asks you if you want to encrypt the image.
If you want to encrypt the image, you'll need to provide a strong passphrase or private key (that you should safely keep in a password manager or similar solution). If not, just keep the default
-senc
option selected to skip the encryption. -
You also have to tell Clonezilla what to do after the whole cloning process is done.
With the highlighted
-p choose
option by default, after the image is cloned, Clonezilla will ask you what to do next. Useful to start the cloning of another storage drive. -
Next, Clonezilla will print a reminder about how to execute the whole process with a long command line.
BEWARE!
The command can only be executed within the Clonezilla's own shell.Just press enter to continue with the cloning process.
-
Right before it starts saving the image, Clonezilla will ask you for a final confirmation.
Answer
y
to the question to finally start the cloning process. -
Clonezilla will then launch the program Partclone, which will be the one doing the cloning job.
-
When Partclone finishes, Clonezilla will print a few informative lines about the last procedure done by Partclone (in this case, the checking of your new image's restorability), and ask you to press enter.
-
You'll reach a new menu that offers several actions to execute at this point.
From this menu you can shutdown (
poweroff
) orreboot
your system, or even get into the Clonezilla shell (cmd
). You can alsorerun
Clonezilla to create another image or maybe restore one.- If you want to use the same repository you used to create the previous image, use the
rerun2
option.
- If you want to use the same repository you used to create the previous image, use the
-
Check on your system or some other computer the image saved. On my Lubuntu computer it looks like below.
Notice how the image is in fact a folder with the name I gave it in Clonezilla. Within this folder you'll see several files.
This is the real structure of a Clonezilla image, so don't touch anything there unless you're using a specialized tool able to handle Clonezilla images.
The restoration process of a basic Clonezilla image, like the one created in the previous section, is as follows.
-
Boot your system with Clonezilla Live and reach the main actions menu screen, where you should choose the
device-image
option. -
As you had to do for the cloning process, you need to configure where the image repository is. Here I'm assuming a external USB drive, so choose
local_dev
and press enter. -
Clonezilla will warn you to plug in now the USB drive in which you have your cloned images stored.
If you didn't already, plug your USB storage now and wait a few seconds to allow Clonezilla detect it. Then press enter.
-
Next you'll see what Clonezilla is detecting as local storage devices.
Above you can see how it sees three storage devices:
/dev/sda
is the first storage device in this computer./dev/sdb
is the second storage device./dev/sdc
is the external USB drive you want to use for loading Clonezilla images.
With your USB drive detected, you can get out of this screen by pressing
Ctrl+C
. -
You'll get into a screen in which you'll have to choose a partition from the ones found within all the previously detected local storage devices.
BEWARE!
Only choose a partition present in your USB storage drive (thesdc
drive in this case) that you know it holds clone images that can be restored in the system.Choose the partition that corresponds to your USB drive, which would be
sdc1
in this case.If there's more than one partition available in your external USB storage, be mindful of which one you're using as repository for your Clonezilla images.
-
After choosing the partition, you'll be asked if you want to check the filesystem within the chosen partition.
Let's trust your USB drive and just skip the check, so keep the
no-fsck
option highlighted and press enter. -
You'll reach the directory browser to choose the exact location of your images repository. If you're using a repository where you've already saved other images, you'll see their directories listed here.
See how, below the
$RECYCLE.BIN
directory, there are two directories that correspond to images done previously. Notice how their names just fit in the listing, so remember to give your Clonezilla images tight names.BEWARE!
Be careful of not choosing the folder of another image to create a new one, although it shouldn't be much a problem since each image is self-contained in its own folder.If the current directory you're seeing now is the one you want to use as repository, press
Done
. -
Clonezilla will print a warning informing you about the repository location you've chosen. Just press
enter
to keep with the procedure. -
Clonezilla will ask you about what mode to use. Use the
Beginner
one, it will be enough. -
Now you get to choose what action to perform. For restoring the image of an entire disk, choose
retoredisk
and press enter. -
Clonezilla will ask you what image to restore from the previously chosen repository.
In this case, there's an image for the
sda
drive and another for thesdb
one. Notice how, next to their names (both ending with the_img
suffix), Clonezilla also shows you:- The date and time in which each image was created (
2021-0805-1350
,2021-0805-1749
). - The device name (
sda
,sdb
). - The size of the cloned storage (
56.0GB
,2147MB
)
Choose the image you want to restore (the
demo_sda_drive_2021-08-04_img
one in this demo) and press enter. - The date and time in which each image was created (
-
Now you need to tell Clonezilla which storage device you want to restore.
Notice how this screen informs you of the size of each drive present in the system. This is important because you cannot restore, for instance, the
sda
's image inside thesdb
drive. In this case, the drive to restore is thesda
one.BEWARE!
When restoring an image, always restore it in a storage drive equal or larger in size than the original drive you cloned it from. Even if the image's data didn't fill the whole original drive, it's filesystem will expect to have available the same storage size it had in the original drive. -
Clonezilla will ask you about checking the image's restorability before restoring it.
Leave the default
Yes
option if you like. -
Now you have to tell Clonezilla what you want it to do after the image has been restored.
If in doubt, just leave the
-p choose
option selected and press enter, so you can decide after the restoration is done. -
Clonezilla will print some lines showing you the command that executes the restoration. Press enter for continuing the process.
-
Next, Clonezilla will launch Partclone to check the image's restorability (if you chose to do so).
-
After checking the image, Clonezilla will ask for your confirmation twice to proceed with the restoration.
Answer
y
and press enter to get to the second confirmation.Again, if you're sure of this operation, answer
y
again to finally execute the restoration. -
After outputting some command lines, Clonezilla will launch Partclone to perform your image's restoration.
-
After Partclone is done, Clonezilla it will output a whole bunch more of command lines before asking you to press enter.
-
Finally, you'll get back to the Clonezilla menu in which you can decide what to do next.
-
The restoration is done. Now you can shutdown Clonezilla, start your system normally and check if the restored drive has been recovered as expected.
Clonezilla is able to see inside filesystem structures in order to make more optimized backups. For instance, is able to detect the swap volume in a Linux setup and just save a reference to it, instead of also backing up its content. Also, it will ignore any empty space and only save content, effectively compacting the data within the backup.
On the other hand, if Clonezilla cannot read the content of a storage drive or volume, it'll be forced to read it completely regardless of it being empty. For example, Clonezilla cannot get inside the virtual drives of your VMs, so it will make backups of the entire drives, free space included.
Also be aware that, by default, Clonezilla splits large backups in 4 GiB chunks. These chunks are gzipped files with an extra alphabetic extension like .aa
, .ab
and so on.
BEWARE!
If there's something particularly odd within the filesystem you're trying to image, Clonezilla may not be able to execute at all. For instance, the hard disks of the VMs running in Proxmox VE are detected by Clonezilla also as partitions and, if Clonezilla cannot access them for some reason, the process will fail.
There are several other tools available, free and paid, that can do the same job as Clonezilla. One that is compatible with Clonezilla images is Rescuezilla. It's much more user friendly and requires fewer steps to perform the backup or restoration of a storage drive, but at the expense of offering less options: for instance, it doesn't offer encryption of images.
<< Previous (G904. Appendix 04) | +Table Of Contents+ | Next (G906. Appendix 06) >>