• Linux中盘符的两种挂载方法


    相信接触过Linux系统的人对于mount命令都不陌生,今天是农历2017年的最后一个工作日,趁着时光还在,就说一下两种不同的挂载方法吧.

    课前小知识:

    命令格式:mount [-t vfstype] [-o options] device dir
    1.-t vfstype 指定文件系统的类型,通常不必指定。mount 会自动选择正确的类型。常用类型有:
    光盘或光盘镜像:iso9660
    DOS fat16文件系统:msdos
    Windows 9x fat32文件系统:vfat
    Windows NT ntfs文件系统:ntfs
    Mount Windows文件网络共享:smbfs
    UNIX(LINUX) 文件网络共享:nfs
    2.-o options 主要用来描述设备或档案的挂接方式。常用的参数有:
    loop:用来把一个文件当成硬盘分区挂接上系统
    ro:采用只读方式挂接设备
    rw:采用读写方式挂接设备
    iocharset:指定访问文件系统所用字符集
    3.device 要挂接(mount)的设备。
    4.dir设备在系统上的挂接点(mount point)。

    挂载方法:根据设备名称进行挂载

    mount /dev/vdb1  /home/mount_dir

    系统启动-自动挂载

    需要在分区表中写入要挂在的项,如下面所示

    root@YLStore:~# cat  /etc/fstab
    # /etc/fstab: static file system information.
    #
    # Use 'blkid' to print the universally unique identifier for a
    # device; this may be used with UUID= as a more robust way to name devices
    # that works even if disks are added and removed. See fstab(5).
    #
    # <file system> <mount point>   <type>  <options>       <dump>  <pass>
    # / was on /dev/sda2 during installation
    UUID=c43c375a-d90a-4aa5-9c6c-1c4912c273b5 /               ext4    errors=remount-ro 0       1
    # swap was on /dev/sda1 during installation
    UUID=4c23d377-7a4e-44d5-972c-ab2f4a54c01c none            swap    sw              0       0
    # mount data store
    UUID=00b90cbf-0577-4cc3-a16a-5decb11485ea    /Store    ext4    defaults    0    0

    系统启动-查找设备UUID

    root@YLStore:~# lsblk -f
    NAME   FSTYPE LABEL UUID                                 MOUNTPOINT
    sda                                                      
    ├─sda1 swap         4c23d377-7a4e-44d5-972c-ab2f4a54c01c [SWAP]
    └─sda2 ext4         c43c375a-d90a-4aa5-9c6c-1c4912c273b5 /
    sdb                                                      
    └─sdb1 ext4         00b90cbf-0577-4cc3-a16a-5decb11485ea /Store
    root@YLStore:~#

    结合上下文可以看到 /Store 挂载的是设备sdb1

    fstab中写设备Label和设备UUID的区别

    一般写设备名称标签即可,不过UUID更保险,即使你关机后把多个硬盘插混了sata口上,也可以根据唯一识别号进行识别

  • 相关阅读:
    UML 基础: 组件图
    如何绘制 UML 活动图
    JVM简介
    【转】Adapter 模式
    用例建模技巧
    【转】JVM内存模型以及垃圾回收
    从UML到BPEL
    用例建模指南
    关于 Assigned
    符号和基本语法
  • 原文地址:https://www.cnblogs.com/wxjnew/p/8434719.html
Copyright © 2020-2023  润新知