CentOS 6.3 下用ntfs-3g挂载移动硬盘 NTFS分区

来源:互联网 发布:mysql 临时表空间不足 编辑:程序博客网 时间:2024/05/29 04:48

【转】http://www.linuxidc.com/Linux/2012-09/70787.htm

【自修该后】

1.安装gcc

yum install gcc


2.安装ntfs-3g


/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: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 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: 0x8e0eee9e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64       38914   312057856   8e  Linux LVM

Disk /dev/mapper/VolGroup-lv_root: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 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: 0x00000000


Disk /dev/mapper/VolGroup-lv_swap: 4261 MB, 4261412864 bytes
255 heads, 63 sectors/track, 518 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: 0x00000000


Disk /dev/sdb: 16.0 GB, 16047407104 bytes
255 heads, 63 sectors/track, 1950 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: 0x3e6c66bb

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1        1950    15663343+   c  W95 FAT32 (LBA)

Disk /dev/mapper/VolGroup-lv_home: 261.6 GB, 261594546176 bytes
255 heads, 63 sectors/track, 31803 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: 0x00000000


Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 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: 0x12181f69

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1      121602   976759808    7  HPFS/NTFS

Disk /dev/sdd: 16.0 GB, 16047407104 bytes
94 heads, 30 sectors/track, 11114 cylinders
Units = cylinders of 2820 * 512 = 1443840 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc3072e18

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1   *           3       11115    15667264    c  W95 FAT32 (LBA)
[root@localhost media]# fdisl -l
bash: fdisl: command not found
[root@localhost media]# fdisk -l

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 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: 0x8e0eee9e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64       38914   312057856   8e  Linux LVM

Disk /dev/mapper/VolGroup-lv_root: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 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: 0x00000000


Disk /dev/mapper/VolGroup-lv_swap: 4261 MB, 4261412864 bytes
255 heads, 63 sectors/track, 518 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: 0x00000000


Disk /dev/sdb: 16.0 GB, 16047407104 bytes
255 heads, 63 sectors/track, 1950 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: 0x3e6c66bb

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1        1950    15663343+   c  W95 FAT32 (LBA)

Disk /dev/mapper/VolGroup-lv_home: 261.6 GB, 261594546176 bytes
255 heads, 63 sectors/track, 31803 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: 0x00000000


Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 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: 0x12181f69

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1      121602   976759808    7  HPFS/NTFS

Disk /dev/sdd: 16.0 GB, 16047407104 bytes
94 heads, 30 sectors/track, 11114 cylinders
Units = cylinders of 2820 * 512 = 1443840 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc3072e18

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1   *           3       11115    15667264    c  W95 FAT32 (LBA)


###################################################################

可以看到1TB移动硬盘格式为ntfs

4、挂载分区,下面我们把

/dev/sdc1 挂载到 /media/windows/c

进入/mediat目录,新建/windows/c
cd /media
mkdir /windows/c

mount -t ntfs-3g /dev/sdc1 /windows/c

分区挂载完成,现在可以进入/media目录下面查看对应的文件夹,即就是你移动硬盘的分区

如果想卸载,可以用下面的命令

umount /dev/sdc1 #卸载

5、如果想让系统开机自动挂载移动硬盘,编辑/etc/fstab文件。
cp /etc/fstab /etc/fstabbak #更改之前先备份
vi /etc/fstab #编辑

用insert命令在最后添加以下信息,以读写方式挂载磁盘

/dev/sdc1 /windows/c ntfs-3g defaults 0 0

执行ESC命令退出。
: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 即可安全退出挂载的设备!



原创粉丝点击