3

I've damaged the drive I had in my Windows laptop and now I want to try to recover as many files as possible. I know very little about Linux though.

I have Ubuntu 10.04 on another machine. I have a docking station for the drive and it is connected to my Linux machine. The drive appears in disk utility.

Unfortunately, this is where I have no idea where to proceed. Any help is appreciated and I can provide more info if needed.

Mat
  • 52,586
Shane
  • 133

1 Answers1

4

Data recovery is a tricky thing, and more suited to a few books than a USE answer. There are lots of myths, legends and voodoo recipes out there. :)

If the disk appears to be talking on the bus, perhaps you can get some of the data. Look up GNU ddrescue. It does block-level rescue of a disk or individual partitions. There's also ‘plain’ ddrescue, which is nearly identical. I've used both.

You'll need ddrescue, the dying disk and another disk of equal or larger size. If you want to rescue disk-to-disk, the disk should probably be identical in size. If not, you can do a disk-to-image copy and then use losetup, dmsetup and mount (with the -o loop option) to get file-level access to the partitions.

ddrescue works a bit like dd (hence the name), but is designed to work around bad sections of a disk. First it copies large chunks, leaving holes (sparse files, if you're saving to a filesystem) where the errors are. It then divides and conquers, copying progressively smaller areas of the problem parts of the disk, until only the failed bad sectors are left uncopied. It can also retry its operations if the disk is behaving erratically.

Also, you can stop it and restart it whenever you feel like, provided you give it a logfile (which is human readable and tells you what disk blocks are damaged). Here's a sample invocation:

ddrescue /dev/sdg /mnt/sdg.img /mnt/sdg-ddrescue.log

You can interrupt it with Ctrl-C and restart it whenever you want. Check the manpage for additional options if the rescue operation isn't going well.

Alexios
  • 19,157