feat: update dependencies and add ntfs3 guide
- Updated dependencies in package.json and pnpm-lock.yaml for @astrojs/cloudflare, @astrojs/markdown-satteri, @astrojs/mdx, and astro. - Added .gitignore entry for tar.gz files. - Created a new post on enabling the ntfs3 filesystem driver on Fedora, detailing installation and performance improvements. - Minor formatting fix in the gauss-jordan-kotlin.md post.
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
---
|
||||
title: 在 Fedora 上启用 ntfs3 文件系统驱动
|
||||
published: 2026-07-24
|
||||
tags: ["Linux", "文件系统"]
|
||||
category: 技术
|
||||
description: 让 NTFS 在 Fedora 上的读写速度更上一层楼
|
||||
---
|
||||
|
||||
前几天突然想起来自己还有一个 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](https://www.paragon-software.com/about/) 开发并贡献给 Linux 内核,在 Linux v5.15-rc1 的 commit [f746406](https://github.com/torvalds/linux/commit/f7464060f7ab9a2424428008f0ee9f1e267e410f) 中正式合并。它的目标是替代早期 Linux 内核中功能有限的只读 ntfs 驱动以及基于 FUSE 的 ntfs-3g。
|
||||
|
||||
## 注意事项
|
||||
|
||||
如果你的电脑是 Windows 与 Linux 双系统,那么请[关闭 Windows 的快速启动](https://learn.microsoft.com/zh-cn/troubleshoot/windows-client/setup-upgrade-and-drivers/wake-on-lan-feature?utm_source=chatgpt.com#more-information)。Windows 的快速启动本质上是休眠,即将完整的内存快照写入到磁盘,在下次启动 Windows 时再将其还原到内存,从而达到快速启动的效果。使用 ntfs3 挂载 Windows 系统盘并写入数据时,有可能会破坏这部分数据,进而造成 Windows 系统在启动时出现不同程度的异常。
|
||||
|
||||
## 开始使用
|
||||
|
||||
### 检查配置
|
||||
|
||||
首先,需要确认内核是否加载了 ntfs3 模块:
|
||||
|
||||
```bash
|
||||
grep ntfs3 /proc/filesystems
|
||||
```
|
||||
|
||||
如果已经有输出,请跳转至[挂载](#挂载)。如果没有输出,说明内核并没有加载 ntfs3 模块,需要手动加载:
|
||||
|
||||
```bash
|
||||
sudo modprobe ntfs3
|
||||
```
|
||||
|
||||
> 注意:Linux 内核从 5.15 开始正式合并 ntfs3 驱动,如果不确定你的内核版本,可使用 `uname -r` 来确认。
|
||||
|
||||
### 挂载
|
||||
|
||||
#### 手动挂载
|
||||
|
||||
在 /mnt 目录下新建一个或多个目录作为挂载点:
|
||||
|
||||
```bash
|
||||
mkdir /mnt/mydrive
|
||||
```
|
||||
|
||||
将硬盘分区通过 ntfs3 挂载在此挂载点:
|
||||
|
||||
```bash
|
||||
# 以我的单分区移动硬盘为例
|
||||
sudo mount -t ntfs3 /dev/sda1 /mnt/mydrive
|
||||
```
|
||||
|
||||
确认:
|
||||
|
||||
```bash
|
||||
mount | grep sda1
|
||||
```
|
||||
|
||||
输出应该类似:
|
||||
|
||||
```
|
||||
/dev/sda1 on /mnt/mydrive type ntfs3 (rw,relatime,uid=0,gid=0,acl,iocharset=utf8,prealloc)
|
||||
```
|
||||
|
||||
#### 自动挂载
|
||||
|
||||
以 udisk2 为例,查看 udisk2 服务运行状态:
|
||||
|
||||
```bash
|
||||
sudo systemctl status udisks2.service
|
||||
```
|
||||
|
||||
创建 udisk2 配置文件,然后编辑:
|
||||
|
||||
```bash
|
||||
sudo touch /etc/udisks2/mount_options.conf
|
||||
sudo nano /etc/udisks2/mount_options.conf
|
||||
```
|
||||
|
||||
写入以下内容:
|
||||
|
||||
```conf
|
||||
[defaults]
|
||||
ntfs:ntfs3_defaults=uid=$UID,gid=$GID
|
||||
ntfs_drivers=ntfs3,ntfs
|
||||
```
|
||||
|
||||
重启 udisk2 服务:
|
||||
|
||||
```bash
|
||||
sudo systemctl restart udisks2.service
|
||||
```
|
||||
|
||||
然后尝试使用 Dolphin 或桌面提示挂载硬盘,再检查:
|
||||
|
||||
```bash
|
||||
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 确实让硬盘的读写速度提升了不少。
|
||||
|
||||
## 参考文档
|
||||
|
||||
- [NTFS3 —— Linux 内核文档](https://linuxkernel.org.cn/doc/html/latest/filesystems/ntfs3.html)
|
||||
@@ -8,7 +8,7 @@ description: 高斯-约旦消元法的 Kotlin 实现
|
||||
|
||||
最让我头疼的几门课已经考完试了,讲讲前几天复习线性代数的时候学到的东西
|
||||
|
||||
> **注意:** 主要是一开始突发奇想,我能不能写一个Kotlin程序,输入矩阵,一键计算矩阵的秩,并输出其行最简形式,然后查阅资料的时候认识到了高斯-约旦消元法
|
||||
> 主要是一开始突发奇想,我能不能写一个 Kotlin 程序,输入矩阵,一键计算矩阵的秩,并输出其行最简形式,然后查阅资料的时候认识到了高斯-约旦消元法
|
||||
|
||||
## 高斯-约旦消元法
|
||||
|
||||
|
||||
Reference in New Issue
Block a user