Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

A few nights ago I have created a backup of my data on an external 500 GB NTFS USB hard drive. I have then formatted my computer, reinstalled Ubuntu and started transferring back the data from the external HDD.

Unfortunately some files have became corrupted and Ubuntu is unable to copy them over. The same issue happens if I login using Windows 7.

Disk Utility detects with SMART that there are "a few bad sectors".

Some of files are perfectly intact, but other files cannot be accessed (nor read, copied...) although they are displayed within nautilus and show the correct file size.

Is there anything I can do to recover this data? I have thought of using TestDisk but this utility seems more useful for repairing lost partitions or deleted files.

I have also thought of using ddrescue so I could at least have a low level copy of the disk but I am not sure what use to make of it in order to recover the data!!!

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

Problem solved! I know this is not related to Ubuntu but I think this could be useful for other people.

I have found out that Window's chkdsk could solve the problem, this is because Ubuntu doesn't support NTFS as well as Windows does. It has taken several hours/days to run the tasks (just Windows scandisk with all options activated) but in the end I have managed to recover 99.98% of the data.

share|improve this answer
    
Nice man. Lost data always sucks. Good job. –  Bruno Pereira Jun 10 '12 at 9:20
    
you did the ntfschk c: /r i suppose ? yeah it takes forever but it is known to remap bad data clusters well.. –  marc-andre benoit Dec 22 '13 at 2:19
add comment

If a drive has unreadable sectors one of the choices you have is to make an image of it with dd forcing it to ignore the damaged sectors and then mount that image to read the useful data.

Create a image of the drive

Use the command sudo fdisk -l to identify your USB disk, note his device path, it should look something like /dev/sd[*], where [*] is a letter representing your USB drive.

When you are sure about the path to the drive you want to copy you can use dd to make a image of it and use the options to keep on reading after failing to read data

dd if=/dev/hd[*] of=/foo_path/foo_image conv=noerror,sync

This will read the device /dev/sd[*], output it to /foo_path/foo_image and ignore read errors. /foo_path/foo_image should not be on the same disk you are reading.

So, lets say you used sudo fdisk -l and you found that your USB drive is /dev/sdb, you can then use any of those commands to make an image just by replacing /dev/hd[*] with /dev/sdb.

Mouting the image file to read the data

You need to create a mount point, lets call it /mnt/ddimage

sudo mkdir /mnt/ddimage

Now mount the image you just created to it

mount /foo_path/foo_image /mnt/ddimage -o loop

You should now be able to read any useful data from the cloned drive image.

share|improve this answer
    
Thank you very much, I would love to try that straight away but I have got another problem. The external damaged drive is 500GB and the maximum space I got on my PC is 500GB. What I will do now is to first resize the damaged drive partition because the data contained is "only" 100GB and then I should be able to create an image of this smaller partition. I will keep you posted with the events (hopefully good) –  Martin Jun 4 '12 at 22:36
    
That is going to be a problem, is the USB disk space divided in any way? Do you have any partitions on it, or just a big one? –  Bruno Pereira Jun 4 '12 at 22:39
    
it's a one entire partition, I could maybe try to resize the partition –  Martin Jun 4 '12 at 22:51
    
I am scared about any bad sectors messing up the resize :/ –  Bruno Pereira Jun 4 '12 at 22:56
    
thanks Bruno, bought a 1TB hard drive to do the job. DD image process has started but I am getting loads of errors e.g. dd: reading `/dev/sdd1': Input/output error 682660416+318 records in 682660734+0 records out 349522295808 bytes (350 GB) copied, 12623.1 s, 27.7 MB/s I am curious to see what comes out once I will be able to mount the image file –  Martin Jun 5 '12 at 19:13
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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