使用ntfsfix解决Linux下无法挂载NTFS硬盘的问题

本文最后更新于:January 20, 2020 pm

使用ntfsfix解决Linux下无法挂载NTFS硬盘的问题,主要是由硬盘分区的$MFT文件出现了问题,可以在windows下使用chkdsk命令或者在Linux下使用ntfsfix来进行修复。

首先是故障详情

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.

接着我在askubuntu上面看到了一个同样的情况,高赞回答里面说是$MFT文件出现了问题,windows下可以使用chkdsk进行修复,之前写过相关的操作教程,这次尝试一下使用Linux下的ntfsfix来修复。

这里需要事先安装好ntfsprogs这个工具,ubuntu下也可以直接使用apt安装,下面使用的是CentOS7作为示范。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ 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.

修复完成之后我们直接进行挂载,这次没有报错,可以正常读写里面的文件了。

1
$ sudo mount /dev/sda1 

由于这里已经在/etc/fstab文件中制定了挂载的目录和方式,所以直接在命令行里面指定要挂载的设备号就能根据/etc/fstab内的信息进行挂载。