Centos7下掛載NTFS文件系統

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 盤而不會出現如上報錯了。。。

_
Centos7下掛載NTFS文件系統

地址:http://www.it610.com/article/3368930.htm

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章