使用 dmesg | tail 命令查看最新的日志:
root@debian:/home/linxin# dmesg | tail
[799922.637697] ntfs3(sda1): It is recommened to use chkdsk.
[799922.643453] ntfs3(sda1): volume is dirty and "force" flag is not set!
[799944.456400] ntfs3(sda1): It is recommened to use chkdsk.
[799944.462180] ntfs3(sda1): volume is dirty and "force" flag is not set!
[799962.495381] ntfs3(sda1): It is recommened to use chkdsk.
[799962.501035] ntfs3(sda1): volume is dirty and "force" flag is not set!
[799979.101860] ntfs3(sda1): It is recommened to use chkdsk.
[799979.106927] ntfs3(sda1): volume is dirty and "force" flag is not set!
[800154.305179] ntfs3(sda1): It is recommened to use chkdsk.
[800154.310856] ntfs3(sda1): volume is dirty and "force" flag is not set!
日志中反复出现的 volume is dirty 是核心问题。较新的 Linux 内核默认使用 ntfs3 驱动来挂载 NTFS 分区,这个驱动非常注重数据安全。如果这块移动硬盘之前在 Windows 上没有安全弹出(直接拔掉),或者 Windows 开启了“快速启动(Fast Startup)”导致处于休眠状态,NTFS 文件系统就会留下一个“脏标记(dirty flag)”。Linux 为了防止数据损坏,会拒绝挂载并提示你去 Windows 下运行 chkdsk 修复。
如果你手头没有 Windows 电脑,或者不想来回插拔,我们可以直接在 Linux 下使用 ntfsfix 工具来清除这个脏标记。
确认出问题的分区名称(我的设备是 /dev/sda1),然后执行修复命令:
root@debian:/home/linxin# ntfsfix -d /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.
看到 processed successfully 就说明修复成功
