首页 > 技术文章 > Centos挂载NTFS移动硬盘

cyl2008 2016-09-01 10:29 原文

挂载移动硬盘

 

 

 

  一。众所周知,在安装完Centos完了以后,是没有编译环境的,我自己挂上光盘,手动安装解决了几十的依赖关系,在配置些软件时,还是经常报些依赖软件包的缺失,很是头疼,后来百度了下centos需要装的编译环境,在这里记录下(使用yum安装)

 yum install gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel openssl-devel libxml2-devel gettext-devel pcre-devel,如果嫌麻烦的话,那就直接yum groupinstall "Development tools"

 

二。安装NTFS-3G依赖FUSE的支持,所以先解压安装FUSE。

    安装FUSE命令:yum install fuse

 

 

 

1)下载ntfs-3g工具:http://www.tuxera.com/community/ntfs-3g-download/

下载完成 ntfs-3g_ntfsprogs-2014.2.15.tgz

2)解压缩 tar -zxvf ntfs-3g_ntfsprogs-2014.2.15.tgz

解压缩后进入文件夹ntfs-3g_ntfsprogs-2014.2.15

3)编译并安装

      ./configure

      make

      make install

4)查看USB设备点

 

[root@Chen ntfs-3g_ntfsprogs-2016.2.22]# fdisk -l

 

Disk /dev/sdb: 120.0 GB, 120034123776 bytes

255 heads, 63 sectors/track, 14593 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: 0x33e90d24

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1   *           1          64      512000   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sdb2              64       14594   116707328   8e  Linux LVM

 

Disk /dev/mapper/vg_chen-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/vg_chen-lv_swap: 3187 MB, 3187671040 bytes

255 heads, 63 sectors/track, 387 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/vg_chen-lv_home: 62.6 GB, 62629347328 bytes

255 heads, 63 sectors/track, 7614 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/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: 0x807f972d

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1               1       38914   312569176    7  HPFS/NTFS

 

 

     #fdisk -l   (需要ROOT权限)

 

 

 

 

 

5)用root权限建立挂载点的文件目录

[root@Chen ntfs-3g_ntfsprogs-2016.2.22]# mkdir /mnt/win

 

 

 

 

6)执行挂载命令

 

命令:mount -t ntfs-3g /dev/sda /mnt/win 执行后出现如下:

 

NTFS signature is missing.

Failed to mount '/dev/sda': 无效的参数

The device '/dev/sda' doesn't seem to have a valid NTFS.

Maybe the wrong device is used? Or the whole disk instead of apartition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?

 

命令:# mount -t ntfs-3g /dev/sda1 /mnt/win 执行后出现如下:

 

The disk contains an unclean file system (0, 0).

The file system wasn't safely closed on Windows. Fixing.

[root@Chen ntfs-3g_ntfsprogs-2016.2.22]#

 

进入 /mnt/win,发现挂载成功,没有急,不过弄了一天了呵呵。

 

如果要开机自动挂载ntfs分区,需要更改/etc/fstab文件

用vi 打开fstab文件加入如下两行

/dev/sda3               /mnt/windows/d          ntfs-3g defaults        0 0

/dev/sda4               /mnt/windows/e          ntfs-3g defaults        0 0

 

 

推荐阅读