Use ntfsfix
to solve the problem of not being able to mount NTFS hard disk under Linux, mainly by the problem of $MFT
file of hard disk partition, you can use chkdsk
command under windows or use ntfsfix
under Linux to fix it.
First the failure details.
1
2
3
4
5
6
7
8
9
10
|
$ sudo mount /dev/sda1
$MFTMirr does not match $MFT (record 3).
Failed to mount '/dev/sda1': Input/output error
NTFS is either inconsistent, or there is a hardware fault, or it's a
SoftRAID/FakeRAID hardware. In the first case run chkdsk /f on Windows
then reboot into Windows twice. The usage of the /f parameter is very
important! If the device is a SoftRAID/FakeRAID then first activate
it and mount a different device under the /dev/mapper/ directory, (e.g.
/dev/mapper/nvidia_eahaabcc1). Please see the 'dmraid' documentation
for more details.
|
Then I saw a similar situation on askubuntu
, and a reply with a high approval rate said that there was a problem with the $MFT
file, which could be fixed using chkdsk
under windows, and I had written a tutorial on how to do it before, but this time I tried to fix it using ntfsfix
under Linux.
Here you need to install ntfsprogs
tool in advance, you can also use apt
to install it directly under ubuntu, the following is CentOS7 as a demonstration.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
$ sudo yum install ntfsprogs
$ sudo ntfsfix /dev/sda1
Mounting volume... $MFTMirr does not match $MFT (record 3).
FAILED
Attempting to correct errors...
Processing $MFT and $MFTMirr...
Reading $MFT... OK
Reading $MFTMirr... OK
Comparing $MFTMirr to $MFT... FAILED
Correcting differences in $MFTMirr record 3...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.
|
After the repair is complete, we mount it directly and this time no error is reported and we can read and write the files inside normally.
Since the directory and method of mounting is already specified in the /etc/fstab
file, specifying the device number to be mounted directly on the command line will allow you to mount it based on the information in /etc/fstab
.