zoukankan      html  css  js  c++  java
  • Linux服务器如何识别移动硬盘?

    序言

    通常我们使用的移动硬盘或U盘一般都是ntfs或fat32的文件系统,常跟服务器打交道的小伙伴,会经常遇到把移动硬盘或U盘上的数据拷贝到Linux服务器上。绝大多数Linux发行版内核支持fat32文件系统,因此我们直接mount即可挂载;然而对于ntfs格式的设备,Linux系统并不支持直接挂载,需要安装ntfs-3g包

    今天我们学习下服务器如何挂载fat32及ntfs文件系统设备的挂载

    一、服务器挂载FAT32移动硬盘(U盘)步骤:

    1)将U盘插入USB接口,检查是否插好

    2)找到U盘所在设备,比如我的就是/dev/sdb1

    [root@qll251 ~]# fdisk -l | grep FAT32
    /dev/sdb1 * 56 640 3580928 c W95 FAT32 (LBA)
    

    3)创建挂载点,比如/fat32

    [root@qll251 ~]# mkdir /fat32
    **```
    4)挂载设备**
    
    ```bash
    [root@qll251 ~]# mount -t vfat /dev/sdb1 /fat32
    

    5)挂载成功后,我们可以在/fat32下识别到U盘中的内容

    6)卸载U盘

    [root@qll251 ~]# umount /fat32
    umount: /fat32: device is busy
    [root@qll251 ~]# rm -rf /fat32
    

    二、Linux服务器挂载NTFS移动硬盘步骤:

    1)安装ntfs-3g

    ntfs-3g有两种安装方式,一种是使用yum进行安装,一种是使用源码包进行编译安装。

    以下两种安装方式,您可按需选择。

    如果您对yum源的的搭建不太熟悉,参考:

    1. yum方式安装ntfs-3g
    [root@qll251 ~]# yum -y install ntfs-3g 
    
    1. 源码包方式安装ntfs-3g
    # 我们从官网上 下载ntfs-3g源码包;
    [root@qll251 ~]# wget https://tuxera.com/opensource/ntfs-3g_ntfsprogs-2017.3.23.tgz
    # 当然如果您的服务器没有互联网环境,参考:
    
    [root@qll251 ~]# yum -y install gcc # 安装gcc编译器
    [root@qll251 ~]# tar -zxvf ntfs-3g_ntfsprogs-2017.3.23.tgz
    [root@qll251 ~]# cd ntfs-3g_ntfsprogs-2017.3.23/
    [root@qll251 ntfs-3g_ntfsprogs-2017.3.23]# ./configure && make && make install
    

    2)找到移动硬盘所在设备,比如我的就是/dev/sdc1

    [root@qll251 ~]# fdisk -l | grep NTFS
    /dev/sdc1 * 1 244 1955776+ 7 HPFS/NTFS 
    

    3)创建挂载点并挂载

    [root@qll251 ~]# mkdir /ntfs
    [root@qll251 ~]# mount -t ntfs-3g /dev/sdc1 /ntfs
    

    4)卸载移动硬盘

    [root@qll251 ~]# umount /ntfs
    [root@qll251 ~]# rm -rf /ntfs
    

    三、常用mount案例

    最后给大家列举下企业中常用的mount案例

    • mount /dev/sr0 /mnt:挂载光盘至/mnt目录
    • mount /dev/sdb1 /data:挂载sdb1分区至/data目录
    • mount -t vfat /dev/sdb1 /fat32:挂载U盘至/fat32目录
    • mount -t ntfs-3g /dev/sdc1 /ntfs:挂载ntfs移动硬盘至/ntfs目录
    • mount -t iso9660 -o loop centos8.iso /mnt:挂载centos8镜像文件至/mnt目录
    • mount -t nfs 192.168.1.251:/data /mnt:挂载远端nfs服务器的/data目录至本地/mnt目录
    • mount -o remount, rw /:单用户模式下,重新以读写模式挂载根

    更多帮助信息请参阅 :mount --help 或者 man mount

    更多IT技术,请微信搜索公众号秦露露或者扫描下方二维码关注

    在这里插入图片描述

    十年磨一剑
  • 相关阅读:
    从程序员到项目经理(十一):每个人都是管理者
    从程序员到项目经理(十):程序员加油站 --要执着但不要固执
    CentOS 7安装KVM并创建虚拟机
    kvm安装及简单使用
    pg_ctl -- 启动、停止、重启 PostgreSQL
    Rabbitmq java
    Rabbitmq安装
    Zabbix通过SNMP监控HP Gen10服务器的硬件
    PostgreSQL忘记密码
    zabbix自动发现与监控内存和CPU使用率最高的进程
  • 原文地址:https://www.cnblogs.com/qinlulu/p/12317313.html
Copyright © 2011-2022 走看看