分享

CentOS7 挂载NTFS分区

 rongq2007 2019-09-04

CentOS上默认是不支持挂载NTFS格式的分区的,需要安装ntfs-3g这个程序就可以对ntfs分区进行读写了。
安装ntfs-3g
0、判断ntfs-3g是否已安装
    1、rpm包安装的,可以用rpm -qa看到,如果要查找某软件包是否安装,用 rpm -qa | grep “软件或者包的名字”:
       [justypc@localhost ~]$ rpm -qa | grep ntfs-3g
       [justypc@localhost ~]$ 

    2、yum方法安装的,可以用yum list installed查找,如果是查找指定包,命令后加 | grep “软件名或者包名”: 
       [justypc@localhost ~]$ yum list installed | grep ntfs-3g
       [justypc@localhost ~]$ 

    3、如果是以源码包自己编译安装的,例如.tar.gz或者tar.bz2形式的,这个只能看可执行文件是否存在了,上面两种方法都看不到这种源码形式安装的包。如果是以root用户安装的,可执行程序通常都在/sbin:/usr/bin目录下。
1、添加aliyun的epel源
    wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
2、yum 安装ntfs-3g
     yum install ntfs-3g
3、判断 yum 安装ntfs-3g是否成功
    [root@localhost justypc]# yum list installed | grep ntfs-3g
    ntfs-3g.x86_64                         2:2016.2.22-3.el7               @epel

[root@localhost cbx2012]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
[root@localhost cbx2012]# yum install ntfs-3g
[root@localhost cbx2012]# yum list installed | grep ntfs-3g

因为CentOS 默认不识别NTFS的磁盘格式,所以我们要借助另外一个软件来挂载,那就是ntfs-3g了

自带的yum源没有这个软件,要用第三方的软件源,这里我用的是阿里的epel.

1. 切换到系统yum目录并下载阿里的epel

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# wget http://mirrors.aliyun.com/repo/epel-7.repo

2. 查找当前源上可用的ntfs-3g软件

[root@localhost yum.repos.d]# yum list ntfs*
已加载插件:fastestmirror, langpacks
Repository epel is listed more than once in the configuration
Repository epel-debuginfo is listed more than once in the configuration
Repository epel-source is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * elrepo: dfw.mirror.rackspace.com
 * epel: mirrors.aliyun.com
已安装的软件包
ntfs-3g.x86_64                        2:2017.3.23-1.el7                  @epel
可安装的软件包
ntfs-3g-devel.x86_64                  2:2017.3.23-1.el7                  epel 
ntfsprogs.x86_64 

3. 安装:

[root@localhost yum.repos.d]# yum -y install ntfs-3g

4. 挂载U盘

插入NTFS格式的U盘,fdisk -l 查看盘符,新建挂载目录并挂载

[root@localhost ~]# fdisk -l

磁盘 /dev/sdb:31.1 GB, 31104958464 字节,60751872 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x00000000

  设备 Boot      Start        End      Blocks  Id  System
/dev/sdb1  *        2048    60751871    30374912    7  HPFS/NTFS/exFAT   -->这里的U盘是sdb1

[root@localhost ~]# mkdir /mnt/ukey

[root@localhost ~]# mount ntfs-3g /dev/sdb1 /mnt/ukey

5. 卸载U盘, 听说不卸载的话到Windows上会提示格式化磁盘 -_-''

[root@localhost ~]# umount /dev/sdb1

本文永久更新链接地址http://www./Linux/2017-08/146365.htm

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多