I accidentally unplug the power line of my laptop, which seems cause some bad sectors on my hard drive. The partitions of that hard drive are all in ntfs format, is there a tool or a way to repair it under Ubuntu?

marked as duplicate by Panther, Mitch Feb 27 '14 at 20:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • bad sectors can not be repaired. You can try ntfsfix , but, IMO , the Linux tools to repair NTFS partitions are not as good as the Microsoft tools. Try to repair from within windows and if you do not use windows consider an alternate file system. – Panther Feb 27 '14 at 19:17

Firstly, before doing anything else, I would check the extent of the damage done to the hard drive since that will in part determine the next step. Check the SMART data through Disk Utility (palimpsest from a terminal). In Disk Utility, select the drive in question and click the "SMART Data" button to view information about the number of disk errors that have been reported.

Take careful note of the "Reallocated Sector Count" and especially the "Uncorrectable Sector Count". Either any amount of uncorrectable sectors, or an excessive amount of reallocated sectors, is an immediate red flag that you should back up your data and replace the drive.

If you see signs of damage at this point but decide to proceed in making alterations to the filesystems anyway, you are doing so at your own risk!

You have a couple options to try to fix corrupt ntfs volumes:

In my experience, using Windows chkdsk is usually the best option, since ntfs is inherently a part of the Windows world, and Linux tools that operate on it are just reverse-engineered solutions. This of course requires that you have a bootable Windows installation on the disk already.

Equivalently, you can run ntfsfix from Ubuntu which will mark the partition in question as 'dirty' so that Windows will automatically run chkdsk on it the next time it's booted. Take note that ntfsfix is not a Linux replacement for chkdsk, as stated in the ntfsfix manual.

If you can't run chkdsk, you may want to try reading up on and running testdisk, a powerful data recovery tool that can fix inaccessible ntfs partitions and make various repairs, but it depends on exactly what kinds of symptoms (if any) you're currently seeing.

Again, if you suspect the integrity of your data is in question you shouldn't hesitate to back up your drive before proceeding, since any further writes may make the problem worse, especially if there's physical damage.

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