1

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.

  • Please, at least clarify what file system type you are talking about. Thank you. :) – Andrea Lazzarotto Dec 8 '18 at 21:42
0

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.
  • Thank you very much. Don't know where to start but I try. Do you have any further videos that I can do it? I use linux instead of microsoft. Thank you again. – LifeIsATest Dec 2 '18 at 14:04
  • Thank you very much. Don't know where to start but I try. Do you have any further videos that I can do it? I use linux instead of microsoft. Thank you again. – LifeIsATest Dec 2 '18 at 14:06
  • @JonA, Did you create the image file image.dd? In that case you should know, if it is an image of a partition or of the whole drive. If you don't know, you can test, if you get something useful when trying to mount the image file. Otherwise you can restore from the image file to a drive according to the details in my answer. Good luck :-) – sudodus Dec 2 '18 at 15:08
  • Mount probably doesn't need the "-o loop", it's man page says "The mount command automatically creates a loop device from a regular file if a filesystem type is not specified or the filesystem is known for libblkid". And could ask file what it thinks of the image, it says this about an image containing the first few megs of an MBR device (like /dev/sda): "DOS/MBR boot sector; partition 1 : ID=0x83...; partition 2 :...", and strangely just this about a partition image (like /dev/sda1): "DOS/MBR boot sector" (but I think that disk might be weird). Or could ask gparted or fdisk... – Xen2050 Dec 3 '18 at 10:23
  • @sudodus I tried to sudo mount ~/home/*username*/Desktop/image.dd /media/disk -t ext3 -o loop still doesnt work. It says. "mount: /media/disk: failed to setup loop device for /home/jonnzen/home/*username*/Desktop/image.dd." – LifeIsATest Dec 9 '18 at 0:12

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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