NTFS (New Technology File System),是Windows NT家族(如,Windows 2000、Windows XP、Windows Vista、Windows 7和 windows 8.1)等的限制级专用的文件系统,针对FAT和HPFS作了若干改进,例如,支持元数据,并且使用了高级数据结构,以便于改善性能、可靠性和磁盘空间利用率,并提供了若干附加扩展功能。属于商业的文件系统。Linux 默认不支持,但是我们可以通过ntfs-3g 来使Linux 识别 NTFS 并进行读写。


1.官方关于ntfs-3g 的介绍:NTFS-3G is a stable, full-featured, read-write NTFS driver for Linux, Android, Mac OS X, FreeBSD, NetBSD, OpenSolaris, QNX, Haiku, and other operating systems. It provides safe handling of the Windows XP, Windows Server 2003, Windows 2000, Windows Vista, Windows Server 2008, Windows 7 and Windows 8 NTFS file systems. A high-performance alternative, called Tuxera NTFS is available for embedded devices and Mac OS X.


如果想要自行通过源码编译安装,系统需要安装基本的编译工具(gcc compiler, libc-dev libraries)

(1)源码(Stable Source Release 2015.3.14)下载:

wget https://tuxera.com/opensource/ntfs-3g_ntfsprogs-2015.3.14.tgz

(2)解压并编译安装:

tar -xzf ntfs-3g_ntfsprogs-2015.3.14.tgz

cd ntfs-3g_ntfsprogs-2015.3.14

./configure
make

make install   #非root 用户可使用 sudo make install 安装

(3)使用方法:

某一次的挂载:mount -t ntfs-3g /dev/DEVICE /mnt

(-t 指定挂载格式,DEVICE名称可以通过fdisk -l 去查找)

开机自动挂载:

 将 /dev/DEVICE /mnt ntfs-3g defaults 0 0 写入到 /etc/fstab 文件中

或者 echo "/dev/sda1 /mnt/windows ntfs-3g defaults 0 0 " >> /etc/fstab (注意使用 '>> ' 追加重定向,使用 '>' 会将/etc/fstab文件覆盖,当然,修改/etc/fstab 文件需要root 权限)


使用rpm包安装:

因使用的CentOS7(基于RHEL7),可到 download.fedora.redhat.com/pub/fedora/epel/7/x86_64/n/ntfs-3g-2015.3.14-2.el7.x86_64.rpm 下载rpm文件

rpm -ivh ntfs-3g-2015.3.14-2.el7.x86_64.rpm

使用方法同上不再赘述


Ps:在使用gnome桌面挂载U盘的时候发现,系统可以识别NTFS 分区的存在,但是通过桌面无法自动挂载,系统会提示:

Error mounting /dev/sdb1 at /run/media/lenovo/v220w: Command-line `mount -t "ntfs" -o "uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,dmask=0077,fmask=0177" "/dev/sdb1" "/run/media/lenovo/v220w"' exited with non-zero exit status 32: mount: unknown filesystem type 'ntfs'

mount 提示未知的文件系统类型 ‘ntfs'

解决办法:

$ mount[Tab][Tab]  #连续按两次 Tab 键作命令补齐

mount             mount.glusterfs   mount.nfs4        mountstats
mount.cifs        mount.lowntfs-3g  mount.ntfs-3g     
mount.fuse        mount.nfs         mountpoint        

可以看到只有mount.ntfs-3g,在使用 mount -t 挂载ntfs 时 mount 会调用 mount.ntfs-3g 而非默认的 mount.ntfs

$ locate mount.ntfs-3g  #查找有关文件所在位置
/usr/local/share/man/man8/mount.ntfs-3g.8
/usr/sbin/mount.ntfs-3g
$ sudo ln -s /usr/sbin/mount.ntfs-3g  /usr/sbin/mount.ntfs   #创建软链接

之后就可以自动识别U 盘而不会出现如上报错了。。。



^_^