Can an image made with Clonezilla be restored without using Clonezilla?
Yes, but you need to use the right tool(s).
The partition backup tool
Clonezilla is actually more of a framework than a unified application, using one of several tools to create backup images. These tools are:
- partclone
- partimage
- dd
- ntfsclone
You should be using partclone
- that's the default, and usually if you installed clonezilla
you also have that one installed. (Also, it's apparently better than ntfsclone even for NTFS.) But as you create your image, pay attention to what gets invoked. If you're done, have a look at the log files /var/log/clonezilla.log
and /var/log/partclone.log
to double-check.
The compression scheme/tool
By default, images are compressed with the gzip scheme, but they could theoretically be compressed with bzip2, lzma or other schemes.
You can check what's the compression format of an image using the file
utility:
$ file /path/to/my/image_file.aa
/path/to/my/image_file.aa: gzip compressed data, last modified: Sun Oct 15h 12:34:56 2017, max speed, from Unix
The decompression tool you use usually has the same name as the compression scheme: gzip
for gzip, lzma
for lzma, bzip2
for bzip2. However, sometimes you might want to run something else. For example: pigz
is a parallelized, multi-core version of gzip which will work much faster (typically).
Examining the image filename to determine which tools to use
Clonezilla places partition backups in a subdirectory, under partimag/
, on whatever device you performed the backup to. Within that directory there are numerous files which we don't care much about right now, and the (usually largest) file - the actual compressed clone image. An example of the path of such a file:
/mnt/sdc1/partimag/2017-10-15-01-my-partition-backup/sdb1.ext4-ptcl-img.gz.aa
So the directory used for images is /mnt/sdc1/partimag
; our specific partition was backed up into the subdirectory 2017-10-15-01-my-partition-backup
, and within that directory, the compressed image is sdb1.ext4-ptcl-img.gz.aa
. Now, this name tells us several things:
- The partition was block device
sdb1
(not so interesting) - The filesystem type was ext4.
- The backup tool was partclone (
ptcl
for short) - The compression scheme was gzip (
gz
- like the extension)
Also, there's a log of the cloning process named clonezilla-img
(yes, it's a confusing name) which you could also use to double-check things.
Important note: I'm ignoring the possibility of the image file being split into pieces of a fixed size. That case needs its own investigation w.r.t. OP's question.
Putting it all together
Suppose you want to restore the image to device /dev/sdd3
. Before doing so, make sure it is unmounted (e.g. with unmount /dev/sdd3
) or you'll mess things up badly.
You now want to decompress the image, and pipe the result to the partition backup tool in restore mode, to write to the relevant block device. For the example given above, and you would run:
cd /mnt/sdc1/partimag/2017-10-15-01-my-partition-backup/ && \
pigz --decompress --stdout sdb1.ext4-ptcl-img.gz.aa \
| partclone.ext4 --restore --output /dev/sdd3
Why this pipleine?
- The image is gzip-compressed, so we would like to invoke
gzip
- butpigz
is faster. - pigz will write its output to its standard output stream, i.e. into the pipe.
- It's a partclone image, so we invoke
partclone
. Actually, partclone has several executables, one per filesystem type, and we need the ext4 binary. partclone
, unless instructed otherwise, reads from its standard input, i.e. the pipe.
When you're all done you can try mounting the device using mount -t ext4 /dev/sdd3 /path/to/mount/point
to check whether the restoration went well. You could also use the fsck
file-system check tool.
UbuntuForums offers a solution to access the contents of a CloneZilla image:
- Prepare a large disk in Linux
- Say if your image is
/home/partimag/YOURIMAGE/
, and the image is/home/partimag/YOURIMAGE/hda1.ntfs-img.aa
,hda1.ntfs-img.ab
... runfile /home/partimag/YOURIMAGE/hda1.ntfs-img.aa
to see if it's gzip, bzip or lzop image. - Say it's gzip, then you can run
cat /home/partimag/YOURIMAGE/hda1.ntfs-img.* | gzip -d -c | ntfsclone --restore-image -o hda1.img
- Then you will have a
hda1.img
which you can mount it bymount -o loop -t ntfs hda1.img /mnt
. Then all the files are in/mnt/
This site says something similar, but with ext3
image: http://blog.christosoft.de/2012/05/mount-clonezilla-image-to-restore-single-file-browse/
However, none of these methods can be used to restore an entire operating system partition!