找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 3486|回复: 0

CentOS 7 挂载NTFS磁盘格式的U盘 [实测好用,强烈推荐]

[复制链接]

305

主题

42

回帖

1421

积分

超级版主

积分
1421
发表于 2024-1-7 18:01:16 | 显示全部楼层 |阅读模式
CentOS 7 挂载NTFS磁盘格式的U盘


因为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


按上述方法实际操作如下,把NTFS格式的U盘挂截到/rsdata/usb中,并查看U盘中内容:

  • [root@bogon rsdata]# mount /dev/sdb1 /rsdata/usb/
  • mount: 未知的文件系统类型“ntfs”
  • [root@bogon rsdata]# cd /etc/yum.repos.d/
  • [root@bogon yum.repos.d]# wget http://mirrors.aliyun.com/repo/epel-7.repo
  • --2017-12-13 13:57:15--  http://mirrors.aliyun.com/repo/epel-7.repo
  • 正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)... 123.129.215.252, 123.129.215.191, 123.129.215.223, ...
  • 正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|123.129.215.252|:80... 已连接。
  • 已发出 HTTP 请求,正在等待回应... 200 OK
  • 长度:1084 (1.1K) [application/octet-stream]
  • 正在保存至: “epel-7.repo”
  • 100%[=================================>] 1,084       --.-K/s 用时 0s
  • 2017-12-13 13:57:20 (146 MB/s) - 已保存 “epel-7.repo” [1084/1084])
  • [root@bogon yum.repos.d]# yum list ntfs*
  • 已加载插件:fastestmirror, langpacks
  • base                                                | 3.6 kB     00:00
  • http://mirrors.aliyuncs.com/epel/7/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/epel/7/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30000 milliseconds')
  • 正在尝试其它镜像。
  • epel                                                | 4.7 kB     00:00
  • extras                                              | 3.4 kB     00:00
  • updates                                             | 3.4 kB     00:00
  • (1/5): epel/x86_64/updateinfo                                      | 860 kB  00:00:08
  • (2/5): extras/7/x86_64/primary_db                                  | 145 kB  00:00:06
  • (3/5): epel/x86_64/group_gz                                        | 266 kB  00:00:17
  • (4/5): updates/7/x86_64/primary_db                                 | 4.5 MB  00:00:21
  • (5/5): epel/x86_64/primary_db                                      | 6.1 MB  00:00:30
  • Loading mirror speeds from cached hostfile
  • * base: mirrors.aliyun.com
  • * epel: mirrors.aliyun.com
  • * extras: mirrors.aliyun.com
  • * updates: 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                            2:2017.3.23-1.el7                         epel
  • [root@bogon yum.repos.d]# yum -y install ntfs-3g
  • 已加载插件:fastestmirror, langpacks
  • Loading mirror speeds from cached hostfile
  • * base: mirrors.aliyun.com
  • * epel: mirrors.aliyun.com
  • * extras: mirrors.aliyun.com
  • * updates: mirrors.aliyun.com
  • 正在解决依赖关系
  • --> 正在检查事务
  • ---> 软件包 ntfs-3g.x86_64.2.2017.3.23-1.el7 将被 安装
  • --> 解决依赖关系完成
  • 依赖关系解决
  • ==========================================================================================
  • Package            架构              版本                          源               大小
  • ==========================================================================================
  • 正在安装:
  • ntfs-3g            x86_64            2:2017.3.23-1.el7             epel            263 k
  • 事务概要
  • ==========================================================================================
  • 安装  1 软件包
  • 总下载量:263 k
  • 安装大小:612 k
  • Downloading packages:
  • ntfs-3g-2017.3.23-1.el7.x86_64.rpm                                 | 263 kB  00:00:06
  • Running transaction check
  • Running transaction test
  • Transaction test succeeded
  • Running transaction
  •   正在安装    : 2:ntfs-3g-2017.3.23-1.el7.x86_64                                      1/1
  •   验证中      : 2:ntfs-3g-2017.3.23-1.el7.x86_64                                      1/1
  • 已安装:
  •   ntfs-3g.x86_64 2:2017.3.23-1.el7
  • 完毕!
  • [root@bogon yum.repos.d]# fdisk -l
  • 磁盘 /dev/sda:445.6 GB, 445602857472 字节,870318081 个扇区
  • Units = 扇区 of 1 * 512 = 512 bytes
  • 扇区大小(逻辑/物理):512 字节 / 4096 字节
  • I/O 大小(最小/最佳):4096 字节 / 4096 字节
  • 磁盘标签类型:dos
  • 磁盘标识符:0x000bff25
  •    设备 Boot      Start         End      Blocks   Id  System
  • /dev/sda1   *        2048     2099199     1048576   83  Linux
  • /dev/sda2         2099200   870318079   434109440   8e  Linux LVM
  • 磁盘 /dev/mapper/cl-root:53.7 GB, 53687091200 字节,104857600 个扇区
  • Units = 扇区 of 1 * 512 = 512 bytes
  • 扇区大小(逻辑/物理):512 字节 / 4096 字节
  • I/O 大小(最小/最佳):4096 字节 / 4096 字节
  • 磁盘 /dev/mapper/cl-swap:4160 MB, 4160749568 字节,8126464 个扇区
  • Units = 扇区 of 1 * 512 = 512 bytes
  • 扇区大小(逻辑/物理):512 字节 / 4096 字节
  • I/O 大小(最小/最佳):4096 字节 / 4096 字节
  • 磁盘 /dev/mapper/cl-home:386.7 GB, 386672885760 字节,755220480 个扇区
  • Units = 扇区 of 1 * 512 = 512 bytes
  • 扇区大小(逻辑/物理):512 字节 / 4096 字节
  • I/O 大小(最小/最佳):4096 字节 / 4096 字节
  • 磁盘 /dev/sdb:15.4 GB, 15376000000 字节,30031250 个扇区
  • Units = 扇区 of 1 * 512 = 512 bytes
  • 扇区大小(逻辑/物理):512 字节 / 512 字节
  • I/O 大小(最小/最佳):512 字节 / 512 字节
  • 磁盘标签类型:dos
  • 磁盘标识符:0xb26fdaad
  •    设备 Boot      Start         End      Blocks   Id  System
  • /dev/sdb1          411648    30031249    14809801    7  HPFS/NTFS/exFAT
  • /dev/sdb2            2048      411647      204800   83  Linux
  • Partition table entries are not in disk order
  • [root@bogon yum.repos.d]# mount /dev/sdb1 /rsdata/usb/
  • [root@bogon yum.repos.d]# cd /rsdata/usb/
  • [root@bogon usb]# ls
  • CentOS-6.9-x86_64-bin-DVD1.iso
  • CentOS-7.3-x86_64-Everything-1611.iso



您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|333cm ( 京ICP备16037542号 )

GMT+8, 2025-7-1 23:10 , Processed in 0.086975 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表