Clonezilla and Rescuezilla Backup Image Corruption: How to Restore Your Files from a Bad Linux Backup Image

Question:

How can I recover files from a corrupted Linux backup image created by Clonezilla or Rescuezilla? I erased the original drive without verifying the backup integrity and now I cannot restore it.

Answer:

How to Recover Files from a Corrupted Linux Backup Image

If you have ever used Clonezilla or Rescuezilla to create a backup image of your Linux system drive, you may have encountered a situation where the backup image is corrupted and cannot be restored. This can happen due to various reasons, such as power failure, disk error, or human error. If you have erased the original drive without verifying the backup integrity, you may feel that you have lost your data forever. However, there is still some hope to recover your files from the corrupted backup image. In this article, we will show you how to do that using some tools and techniques.

A backup image is a file that contains a copy of the entire contents of a disk or a partition. It is usually compressed and encrypted to save space and protect the data. Clonezilla and Rescuezilla are two popular tools that can create and restore backup images of Linux systems. They use a format called partclone, which is designed to handle different file systems and partitions.

A partclone backup image consists of several files, such as:

  • info: This file contains some metadata about the backup image, such as the date, time, size, and checksum of the image.
  • parts: This file contains the information about the partitions that are included in the backup image, such as the partition type, size, and label.
  • aa, ab, ac, etc.: These files are the actual data of the backup image, split into chunks of 4 GB each.
  • How to Check the Integrity of a Backup Image?

    Before you attempt to restore a backup image, it is always a good idea to check its integrity. This can help you avoid restoring a corrupted image and losing your data. Clonezilla and Rescuezilla provide a way to check the integrity of a backup image using the -c option. For example, if your backup image is stored in a directory called backup on a USB drive mounted at /media/usb, you can run the following command to check its integrity:

    “`bash

    sudo clonezilla -c /media/usb/backup

    “`

    This command will scan the backup image and compare the checksums of each chunk with the ones stored in the info file. If the checksums match, the backup image is intact. If the checksums do not match, the backup image is corrupted and cannot be restored.

    How to Recover Files from a Corrupted Backup Image?

    If you have a corrupted backup image, you may still be able to recover some of your files from it. However, this is not a guaranteed process and may require some trial and error. The basic idea is to use a tool called partclone.restore to extract the data from the backup image and mount it as a loop device. Then, you can use a file recovery tool, such as testdisk or photorec, to scan the loop device and recover your files.

    Here are the steps to follow:

    1. Install partclone, testdisk, and photorec on your Linux system. You can use your package manager to do that. For example, on Ubuntu, you can run:

    “`bash

    sudo apt install partclone testdisk photorec

    “`

    2. Locate the backup image files on your storage device. For example, if your backup image is stored in a directory called backup on a USB drive mounted at /media/usb, you can list the files using:

    “`bash

    ls /media/usb/backup

    “`

    You should see something like this:

    “`bash

    info parts aa ab ac ad

    “`

    3. Identify the partition that contains the files you want to recover. You can use the parts file to see the information about the partitions in the backup image. For example, you can run:

    “`bash

    cat /media/usb/backup/parts

    “`

    You should see something like this:

    “`bash

    device=/dev/sda

    parts=2

    1 83 Linux /dev/sda1 10737418240

    2 82 Linux swap / Solaris /dev/sda2 2147483648

    “`

    This means that the backup image contains two partitions: a Linux partition (/dev/sda1) of 10 GB and a swap partition (/dev/sda2) of 2 GB. If you want to recover files from the Linux partition, you need to use the first chunk of the backup image (aa).

    4. Use partclone.restore to extract the data from the backup image chunk and create a loop device. For example, you can run:

    “`bash

    sudo partclone.restore -s /media/usb/backup/aa -o /dev/loop0

    “`

    This command will read the data from the backup image chunk (aa) and write it to the loop device (/dev/loop0). If the backup image chunk is corrupted, you may see some errors or warnings, but the command will try to continue.

    5. Use testdisk or photorec to scan the loop device and recover your files. For example, you can run:

    “`bash

    sudo testdisk /dev/loop0

    “`

    This command will launch testdisk, which is a tool that can recover lost partitions and files. You can follow the instructions on the screen to select the file system type, the partition table type, and the location to save the recovered files. Alternatively, you can run:

    “`bash

    sudo photorec /dev/loop0

    “`

    This command will launch photorec, which is a tool that can recover lost files based on their signatures. You can follow the instructions on the screen to select the file types, the partition table type, and the location to save the recovered files.

    6. Once you have recovered your files, you can unmount the loop device and delete it. For example, you can run:

    “`bash

    sudo umount /dev/loop0

    sudo losetup -d /dev/loop0

    “`

    This command will unmount the loop device (/dev/loop0) and delete it.

    Conclusion

    In

this article, we have shown you how to recover files from a corrupted Linux backup image created by Clonezilla or Rescuezilla. This is not a foolproof method and may not work for every case, but it may give you a chance to salvage some of your data. We hope you found this article helpful and informative. If you have any questions or feedback, please feel free to leave a comment below. Thank you for reading!

Leave a Reply

Your email address will not be published. Required fields are marked *

Privacy Terms Contacts About Us