chkdsk /f /r alternative in ubuntu linux

In windows os chkdsk /f /r will fix a hdd error automatically.
i have lost access in my laptop though i am able to live boot into my laptop using linux.
I have live boot ubuntu 14.04 and i am in a need to run a command to fix hdd logical errors and fix automatically like in windows we can repair using chkdsk /f /r.
So what is the alternative command for chkdsk /f /r in linux in order to fix hdd error?


Solution 1:

AFAIK there is no full replacement for chkdsk. You basically have two options

  • use ntfsfix

ntfsfix is part of ntfs-3g and should be pre-installed on your Ubuntu LiveMedium. It can fix only some fundamental issues with NTFS, but it always triggers a chkdsk on next Windows-startup.

In some cases this can be enough to get it back to a usable state (dependending if Windows can boot far enough to be able to run chkdsk...).

If this fails, you are left with option Nr 2

  • use a Windows install/recovery CD/DVD/BootStick

from there you can run chkdsk from a commandprompt.

If you don't have any Windows-media available, you can also remove the harddrive and connect it to some other Windows-maschine.

Solution 2:

Linux has no tools to fix NTFS file system.

DO NOT use ntfsfix for fixing your disk. It just removes "dirty FS" flag and you get a false sense of security. After a couple of "fixes" your data becomes unrecoverable.

Do use Windows. Either have a separate HDD with Windows, or install VMware, download Windows vmware image from Microsoft, share raw disk with guest OS and check it from there.

Solution 3:

Although it is not as powerful as Windows' chkdsk, you can use following approach:

sudo ntfsfix /dev/sdXY
sudo ntfsresize -i -f -v /dev/sdXY

After that you will be asked to do it in Windows anyways as Linux doesn't have a powerful equivalent, but this can do a good job.

The ntfsresize command above will check for bad clusters and do a filesystem consistency check.

EDIT: Some people are reporting problems that arise with the use of ntfsfix so refrain from using it unless you have no other option as it may cause data loss.