Restore a single Clonezilla file or folder

Mount a Clonezilla backup image to restore only a few files or folders.

Clonezilla, the disk cloning program, saved my bacon more than once, but so far, I always restored the full image. This time, I forgot to copy my ~/.ssh folder before a clean installation. I could have restored the full image, copied the lost folder, and reinstalled the full OS again, but surely there must be a way to restore a single file or folder? Of course, there is!

All you need is enough disk space (as much as the backup image) some free software, and time.


The Windows route looked the easiest, so I tried that one first with Fidel Perez-Smith’s clonezilla-util tool. I connected my backup USB drive and pointed this tool at my most recent backup folder. A few hours later, I was ready to browse the newly mounted L:\ virtual drive to restore my lost folder, or not.

It didn’t work. The Windows version only reads NTFS drives of course and my Linux backup was formatted as EXT4. Oops.


The Linux way. First, we need to convert the Clonezilla backup folder to an image file. For this, we’ll need to install partclone, which can be easily installed from your distro’s repositories. The filename of the partition to restore gives the format for the partclone part of the command: ‘ext4’ in the example below.

  $ cat backup-folder/nvme0n1p1.ext4-ptcl-img.gz | \
    gzip -d -c | \
    partclone.ext4 -r -C --restore_raw_file -s - -o backup.img

Make sure the drive is large enough to store the (temporary) backup.img file. The image can now be mounted as a file system.

  $ mount -o loop backup.img /mnt

Grab the files you need from the /mnt folder and unmount the volume when done. The temporary backup.img can also be removed.

  $ umount /mnt
  $ rm backup.img

Remember kids: backup, backup, backup!