通常情況下,Centos 掛載windows分區會出現mount: unknown filesystem type 'ntfs'。要想把NTFS格式的磁碟掛載到CentOS 6.3下面
需要安裝第三方的外掛程式ntfs-3g,這裡我們採用編譯安裝外掛程式。
1、安裝編譯器,否則不能成功編譯。
yum install gcc
根據提示按Y安裝完成
2、安裝ntfs-3gcd
- /home #進入/home目錄,把軟體下載到此目錄
- wget http://tuxera.com/opensource/ntfs-3g_ntfsprogs-2011.4.12.tgz #下載
- tar zxvf ntfs-3g_ntfsprogs-2011.4.12.tgz #解壓
- cd ntfs-3g_ntfsprogs-2011.4.12 #進入目錄
- ./configure #編譯
- make #安裝
- make install #安裝
- cd .. #返回上一級目錄
- rm -r -f ntfs-3g_ntfsprogs* #刪除安裝程式包
3、fdisk -l #顯示Widows NTFS硬碟分區資訊
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x4b8cb872
Device Boot Start End Blocks Id System
/dev/sda1 * 1 154 1228800 7 HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2 154 6165 48289792 7 HPFS/NTFS
Partition 2 does not end on cylinder boundary.
/dev/sda3 6165 59527 428625920 f W95 Ext'd (LBA)
Partition 3 does not end on cylinder boundary.
/dev/sda4 59527 60802 10240000 12 Compaq diagnostics
Partition 4 does not end on cylinder boundary.
/dev/sda5 6166 19220 104857600 7 HPFS/NTFS
/dev/sda6 19220 53153 272565248 7 HPFS/NTFS
/dev/sda7 53153 53535 3072000 83 Linux
/dev/sda8 53535 53727 1536000 83 Linux
/dev/sda9 53727 53854 1024000 82 Linux swap / Solaris
/dev/sda10 53854 59527 45564928 83 Linux
以上顯示的是我都分盤資訊
4、掛載分區,下面我們把
[root@localhost home]# cd /mnt/
[root@localhost mnt]# mkdir winD
[root@localhost mnt]# mount -t ntfs-3g /dev/sda5 /mnt/winD
分區掛載完成,現在可以進入/mnt目錄下面查看對應的檔案夾,即就是你移動硬碟的分區
5、卸載
umount /dev/sda5
6、如果想讓系統開機自動掛載移動硬碟,編輯/etc/fstab檔案。
cp /etc/fstab /etc/fstabbak #更改之前先備份
vi /etc/fstab #編輯
用insert命令在最後添加以下資訊,以讀寫方式掛載磁碟
/dev/sda1 /mnt/winC ntfs-3g defaults 0 0
/dev/sda5 /mnt/winD ntfs-3g defaults 0 0
/dev/sda6 /mnt/winE ntfs-3g defaults 0 0
/dev/sda7 /mnt/winF ntfs-3g defaults 0 0
執行ESC命令退出。
http://blog.rekfan.com/?p=137
:wq!儲存,退出
現在只要重啟機器,會自動掛載移動硬碟
取消掛載問題:
umount的時候出現如下提示:
[root@rekfan.com /]# umount /dev/sda1
umount: /mnt/upan: device is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
解決方案:
[root@rekfan.com /]# lsof -w /mnt/upan
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
bash 31761 root cwd DIR 8,18 8192 2316326 /mnt/upan/rekfan.com_120526
[root@rekfan.com /]#
使用 lsof -w /mnt/upan 可以看出,有個命令視窗在/mnt/upan/rekfan.com_120526目錄上,關閉這個視窗,或退出這個掛載目錄,再使用 umount 即可安全退出掛載的裝置!