I’ve managed to use ddrescue to create an img file of my dead HDD. 690GB. How can I now attempt to recover data from the .img in Linux?
Is there a way to mount it or some tools that auto recover data from it?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityI’ve managed to use ddrescue to create an img file of my dead HDD. 690GB. How can I now attempt to recover data from the .img in Linux?
Is there a way to mount it or some tools that auto recover data from it?
You can easily convert the image into a block device which will act like a raw hard drive by using the following commands:
losetup loop0 /path/to/imagefile.img
This will create a device "/dev/loop0" which is equivalent to /dev/sda. You can then use
kpartx -a /dev/loop0
To create partitions which existed on the drive - note that the partitions will exist in /dev/mapper/loop0pX rather then /dev/loop0
If these are regular partitions you can then mount them with the regular mount command like mount /dev/mapper/loop0p1 /path/to/mount - or you can activate LVM using the appropriate LVM commands etc.
there are several ways to recover data from an img-file:
with The Sleuth Kit you can recover/extract files from an img-file directly.
sudo apt update && sudo apt install sleuthkit
tsk_recover -a path/to/ddrescue.img /path/to/folder/for/recovered/files
tsk_recover has some other useful options, so i would advise to read its man-page.
with kpartx you can mount the img-file and cherry-pick the needed files with your preferred file-manager, which maybe will need much less space and time if you just need a few files.
sudo apt update && sudo apt install kpartx
sudo kpartx -a path/to/ddrescue.img
sudo kpartx -d path/to/ddrescue.img
(for this case) pretty the same as with kpartx can be achieved with mount.
sudo mount -o loop path/to/ddrescue.img /media/loop_mount
sudo umount /media/loop_mount