Ubuntu – How to restore important data for image.dd? Photorec will lose file names and will scatter the information

backupdata-recoveryddhard driverestore

A few days ago I was in a middle of copying or cutting folders and data to my external hard drive and it was corrupted.

I have tried to locate the lost information on Test Disk but I have now lost it because it has already been over written. The file is 0. 0. copy and completed.

I have now only have the image.dd file. How can I restore this to it's normal folders and files without losing the names? Many thanks.

Best Answer

Image of a partition

If the image.dd file is an image of a partition (or an iso file), you can easily loop mount it and read the files. Change directory to where you have the file and mount it.

sudo mkdir /mnt/pt1
sudo mount -o loop image.dd /mnt/pt1
cd /mnt/pt1
ls -l *

Image of a whole drive

If the image.dd file is an image of a whole drive (a HDD, SSD, pendrive, memory card), it is possible but more complicated to loop mount a partition. You may succeed with kpartx.

In this case it is probably easier to restore from the image file to a drive with at least the same size as the original drive from where it was cloned. Please notice that this drive will be overwritten, so all previous data on it will probably disappear.

You can do that with dd (simple but risky], or with mkusb, which 'wraps a safety belt around dd' by helping you identify the target drive and giving you a final checkpoint.

In Windows there is Win32DiskImager that can also clone with a final checkpoint.

After restoring you can connect the drive,

  • either while running an operating system, and mount the partition(s), browse and read files there,
  • or boot from the drive, if it a system that can boot your computer, and get into its partition(s), browse and read files there.
Related Question