本教程将向您展示如何使用 NTFS-3G 驱动程序在 CentOS 和其他基于 RHEL 的 Linux 操作系统上以读/写模式挂载 NTFS 驱动器。NTFS-3G 是一个稳定的开源 NTFS 驱动程序,支持在 Linux 和其他操作系统上读写 NTFS 驱动器。
什么是NTFS-3G
要挂载任何基于NTFS的文件系统,您需要安装一个名为 NTFS-3G 的工具。在开始安装之前,让我们先了解一下 NTGS3G。
NTFS-3G 驱动程序是一个开源的、免费提供的读写 NTFS 驱动程序,适用于 Linux、FreeBSD、macOS、NetBSD、OpenIndiana、QNX 和 Haiku。它提供对 Windows XP、Windows Server 2003、Windows 2000、Windows Vista、Windows Server 2008、Windows 7、Windows 8、Windows Server 2012、Windows Server 2016、Windows 10 和 Windows Server 2019 NTFS 文件系统的安全快速处理。
该项目的目的是为用户需要与 NTFS 可靠互操作的硬件平台和操作系统开发、质量保证和支持一个可信赖、功能强大的高性能解决方案。除了这个实际目标之外,该项目还旨在探索混合、内核/用户空间文件系统驱动程序方法、性能、可靠性和功能丰富度的限制。
除了 POSIX 定义的通用文件系统功能外,NTFS-3G 还为与 Windows 的互操作性提供特定支持,从而促进与在 Windows 上运行的应用程序共享数据。
更多内容参考:
https://github.com/tuxera/ntfs-3g
安装NTFS-3G
在线安装
NTFS3G驱动程序在 EPEL 存储库中可用。首先,您需要启用EPEL(企业 Linux 的额外软件包)存储库。
$ yum install epel-release
然后我们必须用 yum 安装 ntfs-3g 包。
$ yum -y install ntfs-3g
手动编译安装
手动编译安装前需要提前准备好 NTFS-3G 软件包。
$ tar -zxvf ntfs-3g_ntfsprogs-2022.5.17.tgz
$ cd ntfs-3g_ntfsprogs-2022.5.17/
$ ./configure
$ make
$ make install
$ ntfs-3g --version
ntfs-3g 2022.5.17 integrated FUSE 27
$
识别NTFS分区
我们可以使用fdisk -l命令或者blkid命令查找NTFS分区。
$ blkid | grep ntfs
/dev/sdb2: UUID="F29278029277C99D" TYPE="ntfs"
$
$ fdisk -l
Disk /dev/sdb: 124.8 GB, 124822487040 bytes, 243793920 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xbe4dc8ee
Device Boot Start End Blocks Id System
/dev/sdb1 2048 20973567 10485760 c W95 FAT32 (LBA)
/dev/sdb2 20973568 243791871 111409152 7 HPFS/NTFS/exFAT
$
挂载NTFS分区
在挂载NTFS分区之前,我们需要创建一个挂载点。
$ mkdir /mnt/ntfs
只需要运行以下mount命令即可挂载NTFS分区,其中/dev/sdb2是您NTFS分区的名称。
$ mount -t ntfs-3g /dev/sdb2 /mnt/nfs
挂载成功后,您可以使用df -h命令查看挂载情况。
$ df -h | grep ntfs
/dev/sdb2 107G 4.4G 102G 5% /mnt/ntfs
$
如果您想在操作系统重启后自动挂载NTFS分区,需要在/etc/fstab文件末尾添加以下内容。
$ vim /etc/fstab
/dev/sdb2 /mnt/ntfs ntfs-3g defaults 0 0
卸载NTFS分区
直接使用umount命令可以卸载NTFS分区。
$ umount /mnt/ntfs