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
[[email protected] /]# 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
[[email protected] mnt]# cd ntfs
[[email protected] ntfs]# ls
[[email protected] ntfs]# mkdir wind
[[email protected] ntfs]# mkdir wine
[[email protected] ntfs]# mkdir winf
[[email protected] ntfs]# ls
設定挂載點
[[email protected] ntfs]# mount -t ntfs-3g /dev/sda5 /mnt/ntfs/winf
[[email protected] ntfs]# mount -t ntfs-3g /dev/sda6 /mnt/ntfs/wine
[[email protected] ntfs]# mount -t ntfs-3g /dev/sda7 /mnt/ntfs/wind
分區挂載完成,現在可以進入/mnt/ntfs目錄下面檢視對應的檔案夾,即就是你移動硬碟的分區
5、解除安裝挂載分區
[[email protected] 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!儲存,退出
現在隻要重新開機機器,會自動挂載移動硬碟