Language
Category
Search

How to repair NTFS partitions in Linux. Chkdsk in Linux

Fix mounting issues, inconsistencies, and errors on NTFS partitions in Linux with the ntfsfix command. Prepare a full scan on the next Windows boot

How to repair NTFS partitions in Linux. Chkdsk in Linux
At Terminal By Rudi Drusian Lange
Published on
Last updated

Introduction

The ntfsfix is a useful tool for Linux users who need to fix simple issues on NTFS partitions. It is especially helpful when a partition fails to mount due to inconsistencies or improper unmounting. However, for more severe issues, it is recommended to use chkdsk on Windows.

With ntfsfix, you can:

  • Fix common inconsistencies in the NTFS file system.
  • Reset the NTFS log (Journal), which may be corrupted.
  • Mark the partition for a full check on the next Windows boot.

How to use ntfsfix

Remember to use the root user or the sudo command. The basic syntax of the command is:

# bash

ntfsfix /dev/sdXn

sdXn is the name assigned to the NTFS partition to be repaired. The X identifies the disk, and the n represents the partition index. For example, sda1.

1. Fix inconsistencies and reset the Journal:

# bash

ntfsfix /dev/sda1

This command fixes simple issues in the NTFS file system and resets the Journal (transaction log).

2. Fix issues with improperly unmounted disks:

# bash

ntfsfix -d /dev/sda1

The -d option forces the repair of more severe issues, such as abruptly unmounted disks. If the command successfully repairs the file system, it removes the "dirty" flag. Otherwise, the flag is kept so that chkdsk performs a full check on the next Windows boot.

3. Check the partition status without making changes:

# bash

ntfsfix -n /dev/sda1

Mounting volume... OK
Processing of $MFT and $MFTMirr completed successfully.
Checking the alternate boot sector... OK
NTFS volume version is 3.1.
NTFS partition /dev/sda1 was processed successfully.

The -n option checks the partition status without applying any fixes. It is useful for diagnosing issues without risks.

Common Errors

Here are some common errors that ntfsfix can fix:

  • NTFS is inconsistent
  • The disk contains an unclean file system
  • Mounting volume failed
  • Metadata kept in Windows cache, refused to mount
  • $MFTMirr does not match $MFT (record 0)
  • Wrong fs type, bad option, bad superblock, missing codepage or helper program, or other error
  • NTFS volume version is too new
  • Corrupt hibernation file / hibernation detected
  • Corrupt journal

Repairing NTFS: Practical Example

Here is a real example of how to use ntfsfix to repair a corrupted NTFS partition and successfully mount it.

# bash

mount /dev/sda1 /mnt/hd/

mount: /mnt/hd: wrong fs type, bad option, bad superblock on /dev/sda1, missing codepage or helper program, or other error.

ntfsfix /dev/sda1

Mounting volume... NTFS signature is missing.
FAILED
Attempting to correct errors... NTFS signature is missing.
FAILED
Failed to startup volume: Invalid argument
NTFS signature is missing.
Trying the alternate boot sector
The alternate bootsector is usable
Rewriting the bootsector
The boot sector has been rewritten

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... OK
NTFS volume version is 3.1.
NTFS partition /dev/sda1 was processed successfully.

mount /dev/sda1 /mnt/hd/

# The partition was successfully mounted!

What happened:

  • ntfsfix detected that the NTFS signature was missing.
  • It tried to use an alternate boot sector, which was functional.
  • The boot sector was rewritten, and the MFT (Master File Table) and its mirror were verified and corrected.
  • The Journal (transaction log) was emptied, and the partition was marked as consistent.

References

The primary source for this article was the manual (man page) available on Slackware Linux.

man ntfsfix for more information.

This is not my original language and I don't speak it very well. I used my little knowledge and translators tools to compose the text of this article. Sorry for possible spelling or grammatical errors, suggestions for corrections are appreciated and can be sent to the contact email in the footer of the site. My intention is to share some knowledge and I hope this translation is good enough.


Some of the content on this website, including text, images, graphics and other materials, may be generated or enhanced by artificial intelligence (AI) tools. For more details on the use of AI, please see our Term of Use.