Is there a way to fsck/chkdsk an NTFS drive from Linux?
7 Answers
Yes. This was handled by fsck on some releases. If the partition is not listed in /etc/fstab, then you will likely need to tell it the partition type. I've used this from a Linux CD to recover a partition Windows wouldn't boot from.
Based on the comments below, the actual fixing is done by the ntfsfix program. It should be available, even if there is no program to run a fsck on an NTFS file system.
- 11,345
- 2
- 28
- 25
Unfortunately the ntfsfix tool is very limited compared to Microsoft's chkdsk. Try to get a Windows install going - preferably with the newest version of Windows as Microsoft is presumably constantly improving chkdsk (I hope..) New versions of Windows are often available for free as trials. If the problem is in a USB disk you can try installing Windows in something like VirtualBox and give the VM control of the USB device.
- 974
In my case, none of fsck & ntfsfix could fix the issue of my external NTFS mobile disk.
I end up to boot into windows os, and use follow steps to fix the disk issue.
Steps:
- Check the identifier of the bad disk. e.g
g - Open the "cmd" terminal of windows.
- Input
chkdsk <disk>: /fto fix it.
Where<disk>is the identifier, e.gchkdsk d: /f - Then it would be fixed within seconds (For a disk of size 1Tb).
After years, finally I found something that windows can do easily, but linux can't ;)
@Update - vm solution
You can also create a windows vm (e.g win 7), then mount the mobile disk to windows vm, then you can also use chkdsk to fix the disk, it's similar as boot into a windows machine.
- 401
ln -s /bin/ntfsfix /sbin/fsck.ntfs
fsck /dev/sdg1
fsck from util-linux 2.21.2
Mounting volume... OK
Processing of $MFT and $MFTMirr completed successfully.
Checking the alternate boot sector... FIXED
NTFS volume version is 3.1.
NTFS partition /dev/sdg1 was processed successfully.
On fedora 22, there is another binary :
lrwxrwxrwx. 1 root root 13 May 22 22:13 /usr/sbin/fsck.ntfs -> ../bin/ntfsck
- 187
If you have NTFSProgs installed, you should be able to run fsck.ntfs or fsck -t ntfs to fsck an NTFS drive.
- 6,773
Using a fsck.ntfs solved my similar problem in a Windows ntfs partition + Ubuntu 20.XX LTS partition (can't remember exact version):
Running lsblk -f returns:
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1
├─sda2 vfat FAT32 1950-4B8D 505,9M 1% /boot/efi
└─sda3 ext4 1.0 29ee8e5b-457e-4610-a503-c8142cc40d68
sdb
└─sdb1 ntfs HDD 42AEC908AEC8F607
sdc
├─sdc1 ntfs Recuperação 04C0478BC0478242
└─sdc2 ext4 1.0 8be461e1-7470-45f6-844c-7559ed2769e9 380,6G 8% /
As you can see, I need to fix my HDD labeled driver (42AEC908AEC8F607), so ln -s /bin/ntfsfix /sbin/fsck.ntfs and after an fsck /dev/sdb1 solved for me, even loggin windows 'refuse to mount' FAILED:
root@bruno-andrade:/home/bruno# fsck /dev/sdb1
fsck from util-linux 2.37.2
Mounting volume... The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
FAILED
Attempting to correct errors...
Processing $MFT and $MFTMirr...
Reading $MFT... OK
Reading $MFTMirr... OK
Comparing $MFTMirr to $MFT... OK
Processing of $MFT and $MFTMirr completed successfully.
Setting required flags on partition... OK
Going to empty the journal ($LogFile)... OK
Checking the alternate boot sector... FIXED
NTFS volume version is 3.1.
NTFS partition /dev/sdb1 was processed successfully.
Thanks to @tanguy in his answer: fsck an ntfs drive in Linux
Paragon hasn't yet opensourced tooling to repair a ntfs filesystem alongside their late 2021, kernel 5.15 merged new ntfs3 driver. Their faq entry is not fully clear on it (beyond mkfs):
Are you planning to add any files system utilities? The existing alternatives such as fsck.NTFS/NTFSck and fsck.(v)fat don’t work well, and the community has been waiting for a fix.
Yes, we plan to publish and open-source our mkfs.NTFS utility.
The old, tuxera made ntfs-3g driver has ntfsfix and ntfsck, what in some distrbutions is shipped in driver packages ('ntfs3g','ntfs-3g') or standalone ('ntfs-progs','ntfsprogs-ntfs3'). While ntfsfix is described as only removing a set dirty-bit - it can do more than what the comments from the early 2010 attest to, see the functions in source. It's worthwhile to give them a try.
The most solid advice in the answers is using an original chkdsk, either in a PC nearby or from a livecd that can be downloaded from Microsoft
- 238