15

I'm searching for useful tools for repairing a whole NTFS partition / drive, not only specific files.

My usecase: I'm trying to clone a netbook drive via partimage. Unfortunately the NTFS partition has errors and partimage says it could not properly read from the device and finally quits. It would save a great amount of work if I would be able to capture a disk image and copy it to a functional, new drive and reassemble the netbook.

Tools I already gave a try:

  • ntfsfix - run, but no improvement
  • chkdsk on Windows XP - generating output, obviously repairing, but then quitting and leaving me with an unknown error

On the partition is not really revelant data. Just preventing a Windows XP install and avoiding copying other files is worth trying a few things (or would it be just elegant to tackle the big problems with a few terminal commands..?). Please don't hesitate to recommend tools that may break something.

I'm medium confident to save the partition because Palimpsest (aka Disk Utility) suggests me that the disk has a few bad sectors, but is still "healthy" (green knob).

I'm running natty and have limited, but at least sufficient terminal knowledge.

Braiam
  • 67,791
  • 32
  • 179
  • 269
f4lco
  • 477
  • 1
    have you looked at testdisk? – Shibumi Aug 26 '11 at 14:32
  • 2
    testdisk won't help you recover from faulty sectors. The tool you need seems to be ddrescue (package gddrescue on Ubuntu): http://wiki.lunarsoft.net/wiki/Data_Recovery#ddrescue – arrange Aug 26 '11 at 14:40
  • 1
    @Arrange - I suggest you put it as an answer since it was the same suggestion I was going to make. ddrescue does offer recovery even with problems on the disk. There is an important part of the method of backup/recovery for ddrescure which is this: "After ddrescue finishes the first pass and finishes splitting error areas, all of the sectors it could not read are not tried again. ddrescue quits at that point." – Luis Alvarado Aug 26 '11 at 14:56
  • @arrange at the moment I'm giving ddrescue a try - have both disks plugged in via SATA to increase speed – f4lco Aug 26 '11 at 18:27

1 Answers1

6

Windows' chkdsk is the authoritative NTFS repair tool. If it can't fix it, then you're out of luck. You can try to wipe the whole disk and start over, and the disk may turn out to be ok, or you may need to replace it. Start by zeroing out the whole disk ( assuming it is sda ):

sudo dd if=/dev/zero of=/dev/sda

If that completes without errors, check the SMART stats in the disk utility again. The pending and offline_uncorrectable counts should be zero. If the reallocated sector count is still zero, then the drive is fine, and you can format it and continue to use it. If the reallocated count has gone up, then the drive has some physical damage that may grow worse over time. If it is under warranty, have it replaced. If not, then run the long smart self test once a week or so to make sure no additional bad sectors develop. If more bad sectors do pop up, then you will want to replace the drive.

psusi
  • 37,551
  • Thanks for this answer, but I'm going to buy a new disk no matter what results my recovery attempts yield - I'm going to handle the netbook over to someone else and can't demand disk monitoring. – f4lco Aug 26 '11 at 18:30
  • @phineas as long as all of the counts go back to zero, then there's nothing wrong with the disk, and no need to monitor it. It's just if the reallocated count goes up you have something to watch out for. – psusi Aug 26 '11 at 19:11
  • I tried out and it was the right decision to buy a new disk: ~$ sudo dd if=/dev/zero of=/dev/sdb dd: writing to \/dev/sdb': Input/output error 340185+0 records in 340184+0 records out 174174208 bytes (174 MB) copied, 32.69 s, 5.3 MB/s ` – f4lco Sep 04 '11 at 11:45