CentOS 6.3 下用ntfs-3g挂载Widows NTFS分区

      通常情况下,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 即可安全退出挂载的设备!

posted @ 2012-11-24 09:02  glose  阅读(343)  评论(0编辑  收藏  举报