Windows 上的磁盤分區都是 NTFS 格式,CentOS 等 Linux 版本是不支持 NTFS 格式的。NTFS-3g 這一開源軟件可實現 Linux 系統對 NTFS 的讀寫支持。不只是 Windows 硬盤上的 NTFS 磁盤分區,只要是連在電腦上的任一 NTFS 格式的存儲空間,比如 NTFS 格式的 U 盤,都可使用 NTFS-3g 實現讀寫支持。
1、安裝編譯器,否則不能成功編譯。
yum install gcc
根據提示按Y安裝完成
2、安裝ntfs-3g
1)下載 ntfs-3g
下載地址: http://download.csdn.net/detail/shayboke/9830526
2)解壓
tar zxvf ntfs-3g_ntfsprogs-2015.3.14.tar.gz
3)進入目錄
cd ntfs-3g_ntfsprogs-2011.4.12
4)編譯
./configure
5)安裝
make
make install
3、查看使用
1)顯示系統磁盤信息
fdisk -l
Disk /dev/sdb: 64.0 GB, 64023257088 bytes, 125045424 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: 0x000a99a8
Device Boot Start End Blocks Id System
/dev/sdb1 * 2048 821247 409600 83 Linux
/dev/sdb2 821248 125044735 62111744 8e Linux LVM
Disk /dev/sda: 500.1 GB, 500107862016 bytes, 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0xaff05648
Device Boot Start End Blocks Id System
/dev/sda1 * 124 976768064 488383970+ f W95 Ext'd (LBA)
Partition 1 does not start on physical sector boundary.
/dev/sda5 126 325073226 162536550+ 7 HPFS/NTFS/exFAT
Partition 5 does not start on physical sector boundary.
/dev/sda6 325075338 652253016 163588839+ 7 HPFS/NTFS/exFAT
Partition 6 does not start on physical sector boundary.
/dev/sda7 652255128 976768064 162256468+ 7 HPFS/NTFS/exFAT
4、掛載分區,下面我們把
/dev/sda5分區掛載到/mnt/ntfs/winf
/dev/sda6分區掛載到/mnt/ntfs/wine
/dev/sda7分區掛載到/mnt/ntfs/wind
[root@localhost ntfs]# ls
[root@localhost ntfs]# mkdir wind
[root@localhost ntfs]# mkdir wine
[root@localhost ntfs]# mkdir winf
[root@localhost ntfs]# ls
設置掛載點
[root@localhost ntfs]# mount -t ntfs-3g /dev/sda5 /mnt/ntfs/winf
[root@localhost ntfs]# mount -t ntfs-3g /dev/sda6 /mnt/ntfs/wine
[root@localhost ntfs]# mount -t ntfs-3g /dev/sda7 /mnt/ntfs/wind
分區掛載完成,現在可以進入/mnt/ntfs目錄下面查看對應的文件夾,即就是你移動硬盤的分區
5、卸載掛載分區
[root@localhost ntfs]# umount /dev/sda7
6、如果想讓系統開機自動掛載移動硬盤,編輯/etc/fstab
cp /etc/fstab /etc/fstabbak #更改之前先備份
vi /etc/fstab #編輯
在最後添加以下信息,以讀寫方式掛載磁盤
/dev/sda5 /mnt/ntfs/winf defaults 0 0
/dev/sda6 /mnt/ntfs/wine defaults 0 0
/dev/sda7 /mnt/ntfs/wind defaults 0 0
:wq!保存,退出
現在只要重啓機器,會自動掛載移動硬盤