55

Is there a way to browse Clonezilla images and extract individual files from them without restoring the whole image?

6
  • 1
    Important note: Bounty is for providing a working method for extracting files from WINDOWS - as the *nix version below seems to work well already Jan 16, 2011 at 0:23
  • Why not use the *nix method on windows using Cygwin?
    – Joe
    Jan 17, 2011 at 18:00
  • @Mark Henderson, is firing up a Linux VM an option? Do you have cygwin on your Windows box?
    – Zoredache
    Jan 21, 2011 at 0:46
  • @Zoredache - A Linux VM is an option, but not an ideal one. Does cygwin include "mount"? If it does then that's always worth a shot. FWIW this time around I simply restored the image into a VM and extracted them from there, but that seemed like a round-about kind of way of getting a single file. Jan 21, 2011 at 0:59
  • None of the answers actually provide a way to extract files without restoring the whole image to somewhere, but it doesn't have to be a real disk partition which is used, as an image file will work OK. I don't think it's possible to extract files without mounting, unless there is some filesystem-specific tool which can do this (e.g. debugfs for ext*fs) and partclone can't restore to stdout to pipe data to such a command. So you'll need to extract the whole image and mount it. Aug 22, 2019 at 10:10

6 Answers 6

34

Better use the partclone utility instead:

  1. cd /home/partimag/YOURIMAGE/
  2. Depending on compression method used:
    • If the image is compressed with gzip: cat dir/hda2.ntfs-ptcl-img.gz.* | gunzip | partclone.restore --restore_raw_file -C -s - -o hda2.img
    • If the image is compressed with zstd: zstdcat dir/hda2.ntfs-ptcl-img.zst.* | partclone.restore --restore_raw_file -C -s - -o hda2.img
  3. mount -o loop hda2.img /mnt -t ntfs -o ro

Note: This needs to be done as root, since partclone requires root permissions to write the image, and the mount command will likely only work as root. For zst images you'll need to install zstd (e.g. apt install zstd)

See also CloneZilla FAQ Entry: "How can I restore those *-ptcl-img.* images into a file manually?"

5
  • how can I unencrypt it before ungzipping? I know the passphrase, but the command.
    – antivirtel
    May 2, 2017 at 16:09
  • 8
    as of may 2017, partclone.restore needs --restore_raw_file flag to write to .img file. May 27, 2017 at 12:51
  • 3
    In-case anyone else has the same problem: I needed to use ntfs-3g -o loop hda2.img /mnt instead of mount Apr 25, 2018 at 10:25
  • 1
    @biocyberman I've edited the answer (pending review) to include this option, as I just hit the very same problem! :) Aug 22, 2019 at 9:58
  • 3
    I don't think zcat is the best choice, as it expects each file to be individually gzipped, while it's really just one long gzip stream split into separate files (at least in my old backups, maybe this is no longer the case). This can result in a "gzip: unexpected end of file" error. cat | gunzip works.
    – hcs
    Oct 7, 2019 at 15:58
21

You should be able to mount your CloneZilla image to extract files from it. See instructions here.

  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 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 by

     mount -o loop -t ntfs hda1.img /mnt
    

    Then all the files are in /mnt/

Note: For lzo images, replace gzip -d -c with lzop -d -c

6
  • 8
    Any way to do this in Windows?
    – Pretzel
    Apr 19, 2010 at 1:06
  • 1
    The commands look sane, but when I try them I get an ERROR: Input file is not an image! (invalid magic). What could cause it? Oct 3, 2015 at 9:13
  • If you used CloneZilla with parclone it will not recoved using ntfsclone. Use the command from hal below.
    – Mendes
    Dec 12, 2015 at 21:58
  • Sidenotes: for a gzip archive, one could replace gzip -d -c from your command with zcat. Likewise, for a bzip2 archive, one could use bzip -d -c, or bzcat.
    – cp.engr
    Jan 20, 2018 at 21:09
  • As a practical matter I have found that using partclone
    – holdenweb
    Oct 31, 2018 at 23:51
9

I've made a video that demonstrates how to restore the full disk backup into a virtual machine. Hope it helps: http://www.youtube.com/watch?v=ainjV3X6wqQ

Basically, what you need to do is:

  • Create a VM in VirtualBox (free)
  • Create a virtual disk image for the VM with at least the same size of the backed up disk
  • Store your clonezilla backup in an external HDD or something which can be accessed from the VM
  • Run your VM with the clonezilla ISO in its virtual drive
  • Restore the backup like you would in a real machine
2
  • 1
    How do instructions for restoring a full disk backup answer the question of extracting individual files without restoring the whole image?
    – squillman
    Nov 6, 2013 at 1:17
  • He might need to access stuff that isn't browsable through the filesystem. For example, I had to access my clonezilla backup to export an .SQL file from phpMyAdmin. This was the best way I found to do it. Dec 10, 2013 at 15:04
3
+50

Taken from this article:

There are some limitations. As pointed out earlier, Clonezilla can't restore an image to a drive that is smaller than the original drive. It also doesn't allow for retrieving specific files in an image, it's the whole partition or nothing.

Since the Linux way is pretty much a lucky hack, I'd wait until this feature is officially developed for Windows.

3

I've written a program called clonezilla-util which can mount Clonezilla archives in Windows.

You can mount to a drive letter using this command (requires the Dokan driver):

clonezilla-util.exe mount --input <clonzilla folder> --mount L:\

Then you can access the files in explorer:

enter image description here

Alternate approach

If you don't want to use the Dokan driver, you can extract the partition images using this command:

clonezilla-util.exe extract-partition-image --input <clonzilla folder> --output <folder to extract to>

That creates a file for each partition in the Clonezilla archive.

enter image description here

You can then use 7-Zip to inspect the contents:

enter image description here

1

Try this software:

http://www.mountimage.com/

It looks like it could do it. 14 day trial.

3
  • 1
    Thanks for the answer, unfortuntately I've already tried this software. The problem is that the clonezilla images are compressed with GZip. I was able to uncompress the GZipped files, but mountimage didn't know what to do with them. Jan 17, 2011 at 22:28
  • What was the extension that you have after you uncompress the GZ files?
    – JohnThePro
    Jan 21, 2011 at 18:14
  • One issue is that clonezilla created multiple compressed files. Decompressing them individually is no good, they need to be combined
    – Gogowitsch
    Aug 29, 2021 at 15:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.