您的位置:首页 > 运维架构 > Linux

CentOS6.3中挂载NTFS移动硬盘的经历

2016-01-15 00:00 671 查看
鄙人当年用PC硬盘做了一个移动硬盘(其实并不方便移动,只是外边包装了一个壳子,可以用USB口访问而已),移动硬盘上存放了一些学习资料。某日想把一部分学习资料拿到公司去学习,可公司的本本不允许带回家,家里的本本又被我装了个CentOS玩玩,就想着能不能先把资料拷到CentOS上,再通过其他方式比如U盘什么的拷到公司去。

奈何CentOS并不认识俺当年做的移动硬盘,因为文件系统是NTFS的。网上搜资料,据说可以利用ntfs-3g来让CentOS认识NTFS的文件系统。于是一步一步的做:

1、安装gcc编译器

C代码


# yum install gcc

中间执行过程中,会问你yes or no,输入:y,回车即可。

2、安装ntfs-3g

Java代码


# cd /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 <=安装

3、将移动硬盘接入,然后查看文件系统

Java代码


# fdisk -l

显示结果如下:

Html代码


Disk /dev/sda: 160.0 GB, 160041885696 bytes

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

Device Boot Start End Blocks Id System

/dev/sda1 * 1 26 204800 83 Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2 26 2637 20971520 83 Linux

/dev/sda3 2637 3290 5242880 83 Linux

/dev/sda4 3290 19458 129869824 5 Extended

/dev/sda5 3290 3812 4194304 82 Linux swap / Solaris

Disk /dev/sdb: 160.0 GB, 160041885696 bytes

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

Device Boot Start End Blocks Id System

/dev/sdb1 1 19457 156288321 f W95 Ext'd (LBA)

/dev/sdb5 1 5223 41953684+ 7 HPFS/NTFS

/dev/sdb6 5224 11752 52444161 7 HPFS/NTFS

/dev/sdb7 11753 19457 61890381 7 HPFS/NTFS

可以看出,我的/dev/sdb5、/dev/sdb6、/dev/sdb7都是ntfs文件系统

4、挂载分区

Java代码


# cd /mnt

# mkdir winc

# mount -t ntfs-3g /dev/sdb5 /mnt/winc

5、进入分区查看内容并进行其他操作

Java代码


# cd winc

# ls

说明:当时我第一次把/dev/sdb5挂载完成后,进行操作时,还出了一点小状况:

Java代码


# cd winc

# ls

# cd tools

# ls

进行如上操作时,突然提示:

C代码


ls: 正在读取目录.: 输入/输出错误

即便是回到winc目录执行再执行ls命令也提示类似错误

回到mnt目录执行ls -l命令,类似:

Java代码


?--------- ? ? ? ? ? winc

这里的权限、用户、用户组、大小、时间等等信息都变成问号了

后来又执行fdisk -l命令,结果发现:

Java代码


……以上省略……

Disk /dev/sdc: 160.0 GB, 160041885696 bytes

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

Device Boot Start End Blocks Id System

/dev/sdc1 1 19457 156288321 f W95 Ext'd (LBA)

/dev/sdc5 1 5223 41953684+ 7 HPFS/NTFS

/dev/sdc6 5224 11752 52444161 7 HPFS/NTFS

/dev/sdc7 11753 19457 61890381 7 HPFS/NTFS

NTFS文件系统的设备名从sdb统统变成了sdc,不知是不是因为我不小心碰到移动硬盘还算怎么回事,不管,先将winc卸载,再重新挂载:

Java代码


# umount /mnt/winc

# mount -t ntfs-3g /dev/sdc5 /mnt/winc

# cd /mnt/winc

# ls

然后一切又都OK了。

分享到:


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: