- Created a new post summarizing activities in March 2025, including learning SpringBoot and social interactions. - Added a new sponsor page with support for displaying sponsorship methods, QR codes, and a list of sponsors. - Implemented comment functionality on the sponsor page, with checks for configuration settings. - Enhanced layout and styling for better user experience on the sponsor page.
5.4 KiB
title, published, updated, pinned, tags, category, description, image
| title | published | updated | pinned | tags | category | description | image | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Fedora 启用 ntfs3 内核驱动提升 NTFS 读写性能 | 2026-07-24 | 2026-09-03 | true |
|
技术 | 在 Fedora 上启用 Linux 内核原生 ntfs3 驱动以替代 ntfs-3g,大幅提升 NTFS 移动硬盘读写速度,包含内核模块检查、mount 配置及双系统注意事项。 | ./ensure-ntfs3-on-fedora/paragon-ntfs3.avif |
前几天突然想起来自己还有一个 256G 的 NVMe SSD,是大一的时候买来当移动硬盘用的,可惜之前两次由于对这方面知识的欠缺,购买的硬盘盒都比较差劲,硬盘就一直搁置着。现如今,我还是认为自己需要一个移动硬盘,于是又新购入了一个硬盘盒。组装好后,我尝试在 Fedora 上测试它的读写速度,发现原本理论上是 10 Gbps 的传输速度,在使用 dd 测试顺序写入时,平均速度只有约 142 MB/s!我查阅了大量资料,发现貌似是文件系统的原因,我的硬盘使用的文件系统是 NTFS,而我并不想改用别的文件系统,所以只能找找看有没有两全其美的办法。
于是我发现了 ntfs3 文件系统驱动。
为什么用 NTFS ?
NTFS 是微软为 Windows NT 系列设计的现代文件系统,也是目前 Windows 系统盘指定的文件系统。众所周知,exFAT 文件系统是大家使用移动硬盘的默认选择,因为其兼容性良好,符合移动硬盘跨平台使用的需求。但我使用的并不是传统的 U 盘。对于采用 NVMe SSD 的移动硬盘,其使用方式通常已经从 "移动存储介质" 转变为 "移动工作磁盘" 。相比主要面向移动存储设备兼容性的 exFAT,NTFS 提供日志保护、B+Tree 元数据索引、更完善的权限模型以及对链接、稀疏文件等高级特性的支持,在大量小文件、开发环境和长期数据存储场景下具有明显优势。
什么是 ntfs3 ?
ntfs3 是 Linux 内核中的一个原生 ntfs 读写文件系统驱动,由 Paragon Software Group 开发并贡献给 Linux 内核,在 Linux v5.15-rc1 的 commit f746406 中正式合并。它的目标是替代早期 Linux 内核中功能有限的只读 ntfs 驱动以及基于 FUSE 的 ntfs-3g。
Warning
如果你的电脑是 Windows 与 Linux 双系统,那么请关闭 Windows 的快速启动。Windows 的快速启动本质上是休眠,即将完整的内存快照写入到磁盘,在下次启动 Windows 时再将其还原到内存,从而达到快速启动的效果。使用 ntfs3 挂载 Windows 系统盘并写入数据时,有可能会破坏这部分数据,进而造成 Windows 系统在启动时出现不同程度的异常。
开始使用
检查配置
首先,需要确认内核是否加载了 ntfs3 模块:
grep ntfs3 /proc/filesystems
如果已经有输出,请跳转至挂载。如果没有输出,说明内核并没有加载 ntfs3 模块,需要手动加载:
sudo modprobe ntfs3
Note
Linux 内核从 5.15 开始正式合并 ntfs3 驱动,如果不确定你的内核版本,可使用
uname -r来确认。
挂载
手动挂载
在 /mnt 目录下新建一个或多个目录作为挂载点:
mkdir /mnt/mydrive
将硬盘分区通过 ntfs3 挂载在此挂载点:
# 以我的单分区移动硬盘为例
sudo mount -t ntfs3 /dev/sda1 /mnt/mydrive
确认:
mount | grep sda1
输出应该类似:
/dev/sda1 on /mnt/mydrive type ntfs3 (rw,relatime,uid=0,gid=0,acl,iocharset=utf8,prealloc)
自动挂载
以 udisk2 为例,查看 udisk2 服务运行状态:
sudo systemctl status udisks2.service
创建 udisk2 配置文件,然后编辑:
sudo touch /etc/udisks2/mount_options.conf
sudo nano /etc/udisks2/mount_options.conf
写入以下内容:
[defaults]
ntfs:ntfs3_defaults=uid=$UID,gid=$GID
ntfs_drivers=ntfs3,ntfs
重启 udisk2 服务:
sudo systemctl restart udisks2.service
然后尝试使用 Dolphin 或桌面提示挂载硬盘,再检查:
mount | grep sda1
输出应该类似:
/dev/sda1 on /run/media/black/5A0580082D5EA6A1 type ntfs3 (rw,nosuid,nodev,relatime,uid=1000,gid=1000,acl,iocharset=utf8,prealloc,uhelper=udisks2)
性能测试
- 使用 ntfs-3g:
❰black❙/mnt/mydrive❱✔≻ dd if=/dev/zero of=testfile bs=1G count=4 conv=fdatasync status=progress
4294967296 字节 (4.3 GB, 4.0 GiB) 已复制,28 s,153 MB/s
输入了 4+0 块记录
输出了 4+0 块记录
4294967296 字节 (4.3 GB, 4.0 GiB) 已复制,28.4704 s,151 MB/s
- 使用 ntfs3:
❰black❙/run/media/black/5A0580082D5EA6A1❱✔≻ dd if=/dev/zero of=testfile bs=1G count=4 conv=fdatasync status=progress
4294967296 字节 (4.3 GB, 4.0 GiB) 已复制,4 s,971 MB/s
输入了 4+0 块记录
输出了 4+0 块记录
4294967296 字节 (4.3 GB, 4.0 GiB) 已复制,6.33572 s,678 MB/s
可以看到,ntfs3 确实让硬盘的读写速度提升了不少。