Can an image made with Clonezilla be restored without using Clonezilla?

6,923

Solution 1

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:

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 - but pigz 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.

Solution 2

UbuntuForums offers a solution to access the contents of a CloneZilla image:

  1. Prepare a large disk in Linux
  2. Say if your image is /home/partimag/YOURIMAGE/, and the image is /home/partimag/YOURIMAGE/hda1.ntfs-img.aa, hda1.ntfs-img.ab... run file /home/partimag/YOURIMAGE/hda1.ntfs-img.aa to see if it's gzip, bzip or lzop image.
  3. Say it's gzip, then you can run cat /home/partimag/YOURIMAGE/hda1.ntfs-img.* | gzip -d -c | ntfsclone --restore-image -o hda1.img
  4. Then you will have a hda1.img which you can mount it by mount -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!

Share:
6,923

Related videos on Youtube

Ng Zhong Qin
Author by

Ng Zhong Qin

Updated on September 18, 2022

Comments

  • Ng Zhong Qin
    Ng Zhong Qin almost 2 years

    I created several images with Clonezilla. If I don't have Clonezilla's live CD but I have another Linux distro, Knoppix, for example, that does not have Clonezilla, is there another program to restore the images to the local drive? My understanding is that Clonezilla is an automator of gparted. I don't know.

  • Ramhound
    Ramhound about 10 years
    This is a good answer if the users wants to mount the image. I am just not sure thats what Johny wants though.
  • Kinnectus
    Kinnectus about 10 years
    Not the line above, no. You need to tell partclone that the output is a hard disk: hdb etc. Read the partclone docs.
  • Cornelius
    Cornelius about 10 years
    @johnny no, it doesn't restore the image to HDD. It only allows you to access the files and folders in the image.
  • Ng Zhong Qin
    Ng Zhong Qin about 10 years
    @Cornelius How do I get it to the local drive?
  • Ng Zhong Qin
    Ng Zhong Qin about 10 years
    @Cornelius Yeah, it's the whole computer. Normally I'd use Clonezilla and just put my image back on the drive.
  • Cornelius
    Cornelius about 10 years
    @johnny then you'll have to get CloneZilla.
  • Ng Zhong Qin
    Ng Zhong Qin over 6 years
    Can I mount sdd3?
  • einpoklum
    einpoklum over 6 years
    @johnny: It must be unmounted during the restoration.