因为u盘不能像挂载光盘一样直接连接使用mount挂载,遇到了不能识别ntfs格式的问题,现在已解决

解决方法:yum安装ntfs-3g软件包

完整步骤:

将u盘连接到虚拟机,进系统fdisk -l查看一下能否被识别,如图:

centos 挂载u盘失败 centos无法挂载u盘_yum


用lsblk也可以看到我的u盘在linux的标识是sdg,有2个分区(因为之前做过PE装过系统,所以一个是系统启动盘一个是数据盘)

centos 挂载u盘失败 centos无法挂载u盘_ntfs_02


创建u盘的挂载点/opt/usb

centos 挂载u盘失败 centos无法挂载u盘_yum_03


用挂载光盘的方式挂载u盘报错“未知的文件类型ntfs

因为CentOS下没有默认支持挂载ntfs分区,可以利用ntfs-3g来实现

centos 挂载u盘失败 centos无法挂载u盘_yum_04


而CentOS默认源里没有NTFS-3g,需要配置网络yum源下载软件包,测试下可以联网

centos 挂载u盘失败 centos无法挂载u盘_ntfs_05


centos 挂载u盘失败 centos无法挂载u盘_linux_06


wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

#下载阿里云的yum源配置文件并把内容写进/etc/yum.repos.d/CentOS-Base.repo这个文件中wget:一款下载工具,支持后台执行

-O 把文档写到文件中

centos 挂载u盘失败 centos无法挂载u盘_yum_07


光是这样还不行,没有ntfs-3G的软件包,这时需要再配置epel源:

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

centos 挂载u盘失败 centos无法挂载u盘_yum_08


EPEL源
EPEL(Extra Packages for Enterprise Linux)是由 Fedora 社区打造,为 RHEL 及衍生发行版如 CentOS等提供高质量软件包的项目。装上了 EPEL,就像在 Fedora 上一样,可以通过 yum install 软件包名,即可安装很多以前需要编译安装的软件、常用的软件或一些比较流行的软件,比如现在流行的nginx、htop、ncdu、vnstat等等,都可以使用EPEL很方便的安装更新。

centos 挂载u盘失败 centos无法挂载u盘_ntfs_09


yum clean all

yum makecache #每次重新配置yum源之后都要进行这两个操作

centos 挂载u盘失败 centos无法挂载u盘_centos 挂载u盘失败_10


现在就可以yum装ntfs-3g了

centos 挂载u盘失败 centos无法挂载u盘_centos 挂载u盘失败_11


centos 挂载u盘失败 centos无法挂载u盘_yum_12


再次用mount挂载成功了,但是类型显示为fuseblk

fuse = file system in user space

ntfs-3g并不是内核模块,而是调用fuse来挂载的,所以df -hT的结果会认为是fuseblk(blk=block)

centos 挂载u盘失败 centos无法挂载u盘_ntfs_13


指定挂载类型也不行,除非对u盘格式化(因为u盘存在重要数据不想格式化)到这步挂载成功就可以了

centos 挂载u盘失败 centos无法挂载u盘_centos_14

如果系统没有安装fuse的话也需要安装一下

rpm -q fuse 查看是否安装:

centos 挂载u盘失败 centos无法挂载u盘_centos_15