2

I'm trying to fully understand ddrescue before using it to decide which is the best strategy to recover the most from a maybe damaged HDD. Chances are the hardware is not damaged but before trying any other thing that could damage the HDD more in case it is damaged I'm going to clone the data.

If I understand it ddrescue can be used to clone directly a whole drive to another drive of same or greater size or a partition to other equal or greater same type partition. And if I understand it correctly you can use ddrescue to create a image file of a drive or a partition too.

And what I haven't been able to figure out reading manual is the size of the image.

So, let's say you have a 500GB disk (hda) with two partitions 100GB (hda1) and 400GB (hda2). The 400GB partition has 150GB used and 250GB free. If you use ddrescue to create an image of the hda2 partition, which will be the approximate size of the image? Will it be 400GB or will its size be only the 150GB used space?

And once the image is created which is the best tool to see its contents without restoring it? I'm confused about that either as for what I read looks like you should be able to mount it but I tried with a small NTFS partition with no luck. I have read too that the utility TestDisk should be able to read a disk image.

I would prefer not to have to restore it as it is just a Windows partition and the only thing I want to recover is some folders from the User and a pst from the default outlook store location.

1
  • 2
    The second part of your question ("once the image is created which is the best tool to see its contents without restoring it?") is really a separate (and somewhat confusing) question. Please flesh it out and ask it as a separate question.
    – sleske
    Commented Nov 12, 2015 at 22:44

2 Answers 2

3

If you use ddrescue to create an image of the hda2 partition, which will be the approximate size of the image? Will it be 400GB or will its size be only the 150GB used space?

The former - 400GB. ddrescue does not work with files, it works with disk blocks, and will just (try to) copy every block, no matter what it contains. It has no notion of "free space", it's all just blocks.


Note that ddrescue can write a sparse file (using option --sparse), where blocks of zero bytes will not consume space in the target file.

However, this only applies if the bytes in the input file are zero, and unallocated areas of a filesystem are not necessarily filled with zeros (usually they are filled with old, deleted, data), so the option may not help in your case. Also, some programs may have trouble handling sparse files, so take care.

For more information, see Can ddrescue's sparse option facilitate cloning a drive to a smaller destination drive? .

5
  • But if I clone a NTFS partition it will contain everything including the Master File Table and I will be able to read files from that image, isn't it?
    – Paul Smith
    Commented Nov 12, 2015 at 22:53
  • I'm not sure if I have it clear. I'm asking about when you do something like ddrescue /dev/hda2 /media/othermounteddisk/hda2.img mapfile
    – Paul Smith
    Commented Nov 12, 2015 at 22:55
  • @PaulSmith: Yes, if you clone a complete partition, you will get everything in that partition - that's the whole point. You can then recover deleted files, read files etc.
    – sleske
    Commented Nov 13, 2015 at 1:18
  • I don't think this answer is correct in that ddrescue has sparse writes (see my answer)
    – qwr
    Commented Aug 12, 2018 at 6:21
  • @qwr: Thanks for the information (though sparse writes probably do not help in OP's case). I updated my answer.
    – sleske
    Commented Aug 13, 2018 at 12:26
-1

ddrescue has a sparse (-S or --sparse) option:

Use sparse writes for outfile. (The blocks of zeros are not actually allocated on disc). May save a lot of disc space in some cases. Not all systems support this. Only regular files can be sparse.

2
  • You just cite the manpage. Could you explain how this answers the question?
    – sleske
    Commented Aug 13, 2018 at 17:27
  • "May save a lot of disc space in some cases".
    – qwr
    Commented Aug 13, 2018 at 19:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .