Like the headline says: This little how-to may help if one wants to mount an partition-image made with Clonezilla to recover single files or folders.
While there is no tool like Norton’s “Ghost Explorer” for Clonezilla, so we have to unpack the whole image, process it with partclone and mount it via the loop device.
Fortunately this is no rocket science, most of the work can be done with a one-liner. So here’s the procedure step-by-step:
- If you haven’n already, install “partclone” (and “ntfs-3g” if you want to mount NTFS partitions).
- “cd” to the folder containing the particular Clonezilla-images.
- Now we need to unpack and process the partition image in question:
cat <imagename>.gz.a* | gzip -d -c | partclone.restore -W -o <output filepath> -L <log filepath>For example:
cat sda1.ntfs-ptcl-img.gz.a* | gzip -d -c | partclone.restore -W -o /dir/sda1.img -L /dir/partclone.log
- If you used any other compression than gzip, you need to adjust the line to fit the command suitable to compress and recombine the splitted image again.
- The processing by partclone may take a while. When it has finished, there should be an image-file under the output path, in this case “/dir/sda1.img”.
- Create a mount point for the virtual partition using mkdir. In this example I chose “/mnt/test”.
- The next step differs subject to the filesystem-type of the image. For EXT(3/4) images, just use good-ol’ mount:
mount -o loop -t ext3 /dir/sda1.img /mnt/test
- If the partition type is NTFS, we need to use the tool ntfs-3g instead:
ntfs-3g /dir/sda1.img /mnt/test
- Now the partition is accessible through the mount point. Use any preferred tool to recover your files.
- When you’re done, you can unmount the virtual drive by “umount”, for example “umount /mnt/test”.
- Don’t forget to delete the beforhand created (huge!) image file 😉
- There must the enough space to hold the decompressed image file. So if you want to recover files from the image of a 100GB partition, you will need 100GB free space at the output filepath.
- If your machine has more that one core, you can also use pigz instead of gzip. This will speed up decompression notably by utilizing multiple cpu-cores for decompression: http://zlib.net/pigz/
- The “
-L <log filepath>” parameter may be omitted, then logging will be done to the standard /var/log. In that case you may need root-privileges (Thanks to Sauron for pointing this out).