0

I am trying to ddrescue from a .img file which contains image of my disposed HDD.

So here are my lsblk of entire system right now:

enter image description here

/media/Dummy/Image.img contains the target image that I want to restore.

/dev/sda/sda1 is the location where I am intending to restore all disk information. But again this is the same place from where I am right now running my operating system. Whatever online guide I have seen so far is basically saying to just perform:

ddrescue -f /media/Dummy/Image.img /dev/sda /media/CentOS6/rescue.logfile 

I knew this was impractical, but still I proceeded with that (being virtualized) and crashed my entire system. I am still not sure whether I followed the instruction correctly or not.

I also have created another empty disk space

/media/restores where now I'm intending to restore the stuffs. But this one also not works.

According to instructions I need to first unmount the target disk, that is umount /media/restores and then proceed with ddrescue on that target:

ddrescue -f /media/Dummy/Image.img /dev/sda/sda3 /media/CentOS6/rescue.logfile

This says:

ddrescue: Can't open output file: Not a directory. 

If I mount /dev/sda/sda3 and do the same thing:

ddrescue -f /media/Dummy/Image.img /dev/sda/sda3 /media/CentOS6/rescue.logfile

or, ddrescue -f /media/Dummy/Image.img /media/restores /media/CentOS6/rescue.logfile

I get the same error message: ddrescue: Can't open output file: Not a directory.

Can anyone help me understand ddrescue and how to do that correctly.

0

Whatever a guide says, you should not blindly follow it. Especially if your image was not created according to that guide, otherwise you are going to lose data.

There is no such thing as /dev/sda/sda3, only /dev/sda3.

However, if the file contains whole disk image[1], including partition table, writing it to /dev/sda3 will not work, unless you intend to use if for a virtual machine.

If it is an image with partitions and you will want to restore to /dev/sda, which you cannot, as it is used by running system, you should boot a LiveCD and proceed from there. Beware though, there is no way back and anything on sda will be lost, including your /home which is not on a separate partition.

[1]: You can check what's in the image using kpartx, which will either list partitions if any, or using -a switch create block devices.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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