• RHCSA8.2


    Node1

    配置您的系统以使用默认存储库

    配置您 的系统以使用默认存储库
    
        YUM 存储库已可以从 http://foundation0.ilt.example.com/dvd/BaseOS 和 `http://foundation0.ilt.example.com/dvd/AppStream 使用配置您的系统,以将这些位置用作默认存储库
    
    • 1
    • 2
    • 3
    [root@clear ~]# cat /etc/yum.repos.d/BaseOS_AppStream.repo 
    [BaseOS]
    name=BaseOS
    baseurl=http://foundation0.ilt.example.com/dvd/BaseOS
    gpgcheck=0
    enabled=1
    
    [AppStream]
    name=AppStream
    baseurl=http://foundation0.ilt.example.com/dvd/AppStream
    gpgcheck=0
    enabled=1
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    创建用户帐户

    创建用户帐户
    
    创建下列用户、组和组成员资格:
    
        名为 sysmgrs 的组
    
        用户 natasha ,作为次要组从属于 sysmgrs
    
        用户 harry ,作为次要组还从属于 sysmgrs
    
        用户 sarah ,无权访问系统上的交互式 shell 且不是 sysmgrs 的成员
    
        natasha 、 harry 和 sarah 的密码应当都是 flectrag
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    [root@clear ~]# groupadd sysmgrs
    [root@clear ~]# useradd -G sysmgrs natasha
    [root@clear ~]# useradd -G sysmgrs harry
    [root@clear ~]# useradd -s /bin/false sarah
    [root@clear ~]# echo flectrag | passwd --stdin natasha
    Changing password for user natasha.
    passwd: all authentication tokens updated successfully.
    [root@clear ~]# echo flectrag | passwd --stdin harry
    Changing password for user harry.
    passwd: all authentication tokens updated successfully.
    [root@clear ~]# echo flectrag | passwd --stdin sarah
    Changing password for user sarah.
    passwd: all authentication tokens updated successfully.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13

    配置 cron 作业

    配置 cron 作业
    
    配置 cron 作业,该作业每隔 2 分钟运行并执行以下命令:
    
        logger "EX200 in progress",以用户 natasha 身份运行
    
    • 1
    • 2
    • 3
    • 4
    • 5
    #查看服务状态crond
    [root@clear ~]# systemctl status crond | grep Active
       Active: active (running) since Wed 2023-08-30 15:12:01 EDT; 24min ago
    
    [root@clear ~]# systemctl enable crond
    [root@clear ~]# crontab -e -u natasha
    no crontab for natasha - using an empty one
    crontab: installing new crontab
    [root@clear ~]# crontab -l -u natasha
    */2 * * * * logger "EX200 in progress" 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

    创建协作目录

    创建具有以下特征的协作目录 /home/managers :
    
        /home/managers 的组用权是 sysmgrs
    
        目录应当可被 sysmgrs 的成员读取、写入和访问,但任何其他用户不具这些权限。(当然,root 用户有权访问系统上的所有文件和目录)
    
        /home/managers 中创建的文件自动将组所有权设置到 sysmgrs 组
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    [root@clear ~]# mkdir /home/managers
    [root@clear ~]# chown :sysmgrs  /home/managers
    [root@clear ~]# chmod 2770 /home/managers
    
    • 1
    • 2
    • 3

    配置 NTP

    配置 NTP
    
    配置您的系统,使其成为 materials.example.com 的 NTP 客户端。(注:materials.example.com 是 classroom.example.com 的 DNS 别名)
    
    • 1
    • 2
    • 3
    [root@clear ~]# systemctl status chronyd | grep Active
       Active: active (running) since Wed 2023-08-30 15:10:30 EDT; 44min ago
    [root@clear ~]# vim /etc/chrony.conf
    #添加下面这段 
    [root@clear ~]# cat /etc/chrony.conf | grep materials
    server materials.example.com iburst
    [root@clear ~]# systemctl restart chronyd
    [root@clear ~]# timedatectl 
                   Local time: Wed 2023-08-30 15:56:35 EDT
               Universal time: Wed 2023-08-30 19:56:35 UTC
                     RTC time: Wed 2023-08-30 19:51:45
                    Time zone: America/New_York (EDT, -0400)
    System clock synchronized: yes
                  NTP service: active
              RTC in local TZ: no
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15

    配置 autofs

    配置 autofs
    
    配置 autofs ,以按照如下所述自动挂载远程用户的主目录:
    
        materials.example.com ( 172.25.254.254 ) NFS 导出 /rhome 到您的系统。此文件系统包含为用户 remoteuser1 预配置的主目录
    
        remoteuser1 的主目录是 materials.example.com:/rhome/remoteuser1
    
        remoteuser1 的主目录应自动挂载到本地 /rhome 下的 /rhome/remoteuser1
    
        主目录必须可供其用户写入
    
        remoteuser1 的密码是 flectrag
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    [root@clear ~]# yum -y install autofs
    
    [root@clear ~]# vim /etc/auto.master
    auto.master    auto.master.d/ 
    [root@clear ~]# vim /etc/auto.master  
    #设置自动挂载
    [root@clear ~]# cat /etc/auto.master | grep rhome
    /rhome    /etc/auto.rhome
    [root@clear ~]# vim /etc/auto.rhome
    #设置权限
    [root@clear ~]# cat /etc/auto.rhome 
    remoteuser1 -rw materials.example.com:/rhome/remoteuser1
    [root@clear ~]# systemctl enable --now autofs
    Created symlink /etc/systemd/system/multi-user.target.wants/autofs.service → /usr/lib/systemd/system/autofs.service.
    [root@clear ~]# systemctl restart autofs
    [root@clear ~]# echo flectrag | passwd --stdin remoteuser1
    Changing password for user remoteuser1.
    passwd: all authentication tokens updated successfully.
    [root@clear ~]# su - remoteuser1 
    [remoteuser1@clear ~]$ pwd
    /rhome/remoteuser1
    [remoteuser1@clear ~]$ exit
    logout
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23

    配置 /var/tmp/fstab 权限

    配置 /var/tmp/fstab 权限
    
    将文件 /etc/fstab 复制到 /var/tmp/fstab 。配置 /var/tmp/fstab 的权限以满足如下条件:
    
        文件 /var/tmp/fstab 自 root 用户所有
    
        文件 /var/tmp/fstab 属于组 root
    
        文件 /var/tmp/fstab 应不能被任何人执行
    
        用户 natasha 能够读取和写入 /var/tmp/fstab
    
        用户 harry 无法写入或读取 /var/tmp/fstab
    
        所有其他用户(当前或未来)能够读取 /var/tmp/fstab
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    [root@clear ~]# cp /etc/fstab /var/tmp/fstab
    [root@clear ~]# ll /var/tmp/fstab
    [root@clear ~]# setfacl -m u:natasha:rw /var/tmp/fstab 
    [root@clear ~]# setfacl -m u:harry:- /var/tmp/fstab 
    [root@clear ~]# getfacl /var/tmp/fstab 
    getfacl: Removing leading '/' from absolute path names
    # file: var/tmp/fstab
    # owner: root
    # group: root
    user::rw-
    user:natasha:rw-
    user:harry:---
    group::r--
    mask::rw-
    other::r--
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15

    配置用户帐户

    配置用户帐号
    
    配置用户 manalo ,其用户 ID 为 3533。此用户的密码应当为 flectrag。
    
    • 1
    • 2
    • 3
    [root@clear ~]# useradd -u 3533 manalo
    [root@clear ~]# echo flectrag | passwd --stdin manalo
    Changing password for user manalo.
    passwd: all authentication tokens updated successfully.
    [root@clear ~]# tail -1 /etc/passwd
    manalo:x:3533:3533::/home/manalo:/bin/bash
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    查找文件

    查找文件
    
    查找当 jacques 所有的所有文件并将其副本放入 /root/findfiles 目录
    
    • 1
    • 2
    • 3
    [root@clear ~]# mkdir /root/findfiles
    [root@clear ~]# find / -user jacques -exec cp -a {} /root/findfiles \;
    find: ‘/proc/25337/task/25337/fd/6’: No such file or directory
    find: ‘/proc/25337/task/25337/fdinfo/6’: No such file or directory
    find: ‘/proc/25337/fd/7’: No such file or directory
    find: ‘/proc/25337/fdinfo/7’: No such file or directory
    [root@clear ~]# ll /root/findfiles/
    total 0
    -rw-r--r--. 1 jacques jacques 0 Aug 30 16:23 gamelan
    -rw-r--r--. 1 jacques jacques 0 Aug 30 16:23 jacques
    -rw-r--r--. 1 jacques jacques 0 Aug 30 16:23 libWedgeit.so.1.2.3
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    查找字符串

    查找字符串
    
    查找文件 /usr/share/xml/iso-codes/iso_639_3.xml 中包含字符串 ng 的所有行。将所有这些行的副本按原始顺序放在文件 /root/list 中。 /root/list 不得包含空行,且所有行必须是 /usr/share/xml/iso-codes/iso_639_3.xml 中原始行的确切副本。
    
    • 1
    • 2
    • 3
    [root@clear ~]# grep ng  /usr/share/xml/iso-codes/iso_639_3.xml  > /root/list
    
    • 1

    创建存档

    创建存档
    
    创建一个名为 /root/backup.tar.gz 的 tar 存档,其应包含 /usr/local 的 tar 存档,其应包含 /usr/local 的内容。该 tar 存档必须使用 gzip 进行压缩。
    
    • 1
    • 2
    • 3
    [root@clear ~]# tar -czvf  /root/backup.tar.gz /usr/local
    [root@clear ~]# file /root/backup.tar.gz 
    /root/backup.tar.gz: gzip compressed data, last modified: Wed Aug 30 20:30:16 2023, from Unix, original size 51200
    
    • 1
    • 2
    • 3

    添加免密操作

    允许sysmgrs组成员sudo时不需要密码

    visudo #进⼊编辑sudo
     在110⾏下编写或者是在 #%wheel下编写
    %sysmgrs ALL=(ALL) NOPASSWD: ALL
    
    • 1
    • 2
    • 3

    配置创建新用户密码策略

    创建新用户,默认密码策略20天后密码过期

    [root@clear ~]# cat /etc/login.defs | grep PASS_MAX_DAYS
    #    PASS_MAX_DAYS    Maximum number of days a password may be used.
    PASS_MAX_DAYS    20
    
    
    [root@clear ~]# useradd usr1
    [root@clear ~]# chage usr1
    Changing the aging information for usr1
    Enter the new value, or press ENTER for the default
    
        Minimum Password Age [0]: ^X
    chage: error changing fields
    [root@clear ~]# chage usr1
    Changing the aging information for usr1
    Enter the new value, or press ENTER for the default
    
        Minimum Password Age [0]: 
        Maximum Password Age [20]: 
        Last Password Change (YYYY-MM-DD) [2023-08-30]: 
        Password Expiration Warning [7]: 
        Password Inactive [-1]: 
        Account Expiration Date (YYYY-MM-DD) [-1]:
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22

    Node2

    设置 root 密码

    设置 root 密码
    
    将 node2 的 root 密码设置为 flectrag 。您需要获得系统访问权限才能进行此操作。
    
    • 1
    • 2
    • 3

    配置您的系统以使用默认存储库

    配置您 的系统以使用默认存储库
    
        YUM 存储库已可以从 http://foundation0.ilt.example.com/dvd/BaseOS 和 http://foundation0.ilt.example.com/dvd/AppStream 使用配置您的系统,以将这些位置用作默认存储库
    
    • 1
    • 2
    • 3
    • 与node1存储文件相同,将其复制过去

      [root@clear ~]# scp /etc/yum.repos.d/BaseOS_AppStream.repo node2:/etc/yum.repos.d/
      The authenticity of host 'node2 (172.25.250.200)' can't be established.
      ECDSA key fingerprint is SHA256:1H687jfusVXYAUzAuByFfx1U/lB4VS+6h04wRhXhmZU.
      Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
      Warning: Permanently added 'node2,172.25.250.200' (ECDSA) to the list of known hosts.
      root@node2's password: 
      BaseOS_AppStream.repo                         100%  203    15.1KB/s   00:00  
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
    • 在node2上查看

      [root@node2 ~]# ls /etc/yum.repos.d/
      BaseOS_AppStream.repo
      [root@node2 ~]# yum repolist
      repo id                                 repo name
      AppStream                               AppStream
      BaseOS                                  BaseOS
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6

    调整逻辑卷大小

    设置逻辑卷大小
    
    将逻辑卷 vo 及其文件系统的大小调整到 230 MiB。确保文件系统内容保持不变。注:分区大小很少与请求的大小完全相同,因此可以接受范围为 217 MiB 到 243 MiB 的大小。
    
    • 1
    • 2
    • 3
    #查看文件格式和存储大小
    [root@node2 ~]# df -Th
    Filesystem           Type      Size  Used Avail Use% Mounted on
    devtmpfs             devtmpfs  887M     0  887M   0% /dev
    tmpfs                tmpfs     914M     0  914M   0% /dev/shm
    tmpfs                tmpfs     914M   17M  897M   2% /run
    tmpfs                tmpfs     914M     0  914M   0% /sys/fs/cgroup
    /dev/vda3            xfs       9.9G  1.6G  8.4G  16% /
    /dev/vda2            vfat      100M  6.8M   94M   7% /boot/efi
    /dev/mapper/myvol-vo ext4      175M  1.6M  160M   1% /reports
    tmpfs                tmpfs     183M     0  183M   0% /run/user/0
    
    #查看myvol组
    [root@node2 ~]# vgs myvol
      VG    #PV #LV #SN Attr   VSize   VFree  
      myvol   1   1   0 wz--n- 508.00m 324.00m 
    
    #拓展
    [root@node2 ~]# lvextend -L 230M /dev/myvol/vo
      Rounding size to boundary between physical extents: 232.00 MiB.
      Size of logical volume myvol/vo changed from 184.00 MiB (46 extents) to 232.00 MiB (58 extents).
      Logical volume myvol/vo successfully resized.
     #同步信息到系统内核
    [root@node2 ~]# resize2fs /dev/myvol/vo
    resize2fs 1.45.4 (23-Sep-2019)
    Filesystem at /dev/myvol/vo is mounted on /reports; on-line resizing required
    old_desc_blocks = 2, new_desc_blocks = 2
    The filesystem on /dev/myvol/vo is now 237568 (1k) blocks long.
    
    [root@node2 ~]# df -Th /reports/
    Filesystem           Type  Size  Used Avail Use% Mounted on
    /dev/mapper/myvol-vo ext4  221M  2.1M  204M   1% /reports
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32

    添加交换分区

    添加交换分区
    
    向您的系统添加一个额外的交换分区 756MiB 。交换分区应在系统启动时自动挂载。不要删除或以任何方式改动系统上的任何现有交换分区。
    
    • 1
    • 2
    • 3
    #查看磁盘情况
    [root@node2 ~]# lsblk
    NAME            MAJ:MIN RM  SIZE RO TYPE M
    OUNTPOINT
    vda             252:0    0   10G  0 disk 
    ├─vda1          252:1    0    1M  0 part 
    ├─vda2          252:2    0  100M  0 part /boot/efi
    └─vda3          252:3    0  9.9G  0 part /
    vdb             252:16   0    4G  0 disk 
    ├─vdb1          252:17   0  510M  0 part 
    │ └─myvol-vo    253:0    0  232M  0 lvm  /reports
    └─vdb2          252:18   0  512M  0 part 
      └─vgroup-swap 253:1    0  256M  0 lvm  [SWAP]
    vdc             252:32   0   10G  0 disk 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    #创建一个新分区
    [root@node2 ~]# fdisk /dev/vdb
    
    Welcome to fdisk (util-linux 2.32.1).
    Changes will remain in memory only, until you decide to write them.
    Be careful before using the write command.
    
    
    Command (m for help): n
    Partition type
       p   primary (2 primary, 0 extended, 2 free)
       e   extended (container for logical partitions)
    Select (default p): 
    
    Using default response p.
    Partition number (3,4, default 3): 
    First sector (2095106-8388607, default 2097152):  
    Last sector, +sectors or +size{K,M,G,T,P} (2097152-8388607, default 8388607): +756M
    
    Created a new partition 3 of type 'Linux' and of size 756 MiB.
    
    Command (m for help): w
    The partition table has been altered.
    Syncing disks.  
    
    [root@node2 ~]# lsblk
    NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    vda             252:0    0   10G  0 disk 
    ├─vda1          252:1    0    1M  0 part 
    ├─vda2          252:2    0  100M  0 part /boot/efi
    └─vda3          252:3    0  9.9G  0 part /
    vdb             252:16   0    4G  0 disk 
    ├─vdb1          252:17   0  510M  0 part 
    │ └─myvol-vo    253:0    0  232M  0 lvm  /reports
    ├─vdb2          252:18   0  512M  0 part 
    │ └─vgroup-swap 253:1    0  256M  0 lvm  [SWAP]
    └─vdb3          252:19   0  756M  0 part 
    vdc             252:32   0   10G  0 disk 
     #格式化交换分区
    [root@node2 ~]# mkswap /dev/vdb3
    Setting up swapspace version 1, size = 756 MiB (792719360 bytes)
    no label, UUID=b6992756-ad20-458d-aeac-e1b362d235e2
    [root@node2 ~]# vim /etc/fstab
    [root@node2 ~]# cat /etc/fstab | grep vdb3 #启动自动挂载
    /dev/vdb3 none swap defaults 0 0
    [root@node2 ~]# swapon -a  #将/etc/fstab⽂件中所有设置为swap的设备,启动为交换区
    [root@node2 ~]# swapon  #激活交换空间
    NAME      TYPE      SIZE USED PRIO
    /dev/dm-1 partition 256M   0B   -2
    /dev/vdb3 partition 756M   0B   -3
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50

    创建逻辑卷

    创建逻辑卷
    
    根据如下要求,创建新的逻辑卷:
    
        逻辑卷取名为 qa ,属于 qagroup 卷组,大小为 60 个扩展块
    
        qagroup 卷组中逻辑卷的扩展块大小应当为 16 MiB
    
        使用 ext3 文件系统格式化新逻辑卷。该逻辑卷应在系统启动时自动挂载到 /mnt/qa 下
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    [root@node2 ~]# lsblk
    NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    vda             252:0    0   10G  0 disk 
    ├─vda1          252:1    0    1M  0 part 
    ├─vda2          252:2    0  100M  0 part /boot/efi
    └─vda3          252:3    0  9.9G  0 part /
    vdb             252:16   0    4G  0 disk 
    ├─vdb1          252:17   0  510M  0 part 
    │ └─myvol-vo    253:0    0  232M  0 lvm  /reports
    ├─vdb2          252:18   0  512M  0 part 
    │ └─vgroup-swap 253:1    0  256M  0 lvm  [SWAP]
    └─vdb3          252:19   0  756M  0 part [SWAP]
    vdc             252:32   0   10G  0 disk 
    [root@node2 ~]# fdisk /dev/vdb   #新建分区
    
    Welcome to fdisk (util-linux 2.32.1).
    Changes will remain in memory only, until you decide to write them.
    Be careful before using the write command.
    
    
    Command (m for help): n
    Partition type
       p   primary (3 primary, 0 extended, 1 free)
       e   extended (container for logical partitions)
    Select (default e): p
    
    Selected partition 4
    First sector (2095106-8388607, default 3645440): 
    Last sector, +sectors or +size{K,M,G,T,P} (3645440-8388607, default 8388607):  
    
    Created a new partition 4 of type 'Linux' and of size 2.3 GiB.
    
    Command (m for help): w
    The partition table has been altered.
    Syncing disks.
    
    [root@node2 ~]# lsblk
    NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    vda             252:0    0   10G  0 disk 
    ├─vda1          252:1    0    1M  0 part 
    ├─vda2          252:2    0  100M  0 part /boot/efi
    └─vda3          252:3    0  9.9G  0 part /
    vdb             252:16   0    4G  0 disk 
    ├─vdb1          252:17   0  510M  0 part 
    │ └─myvol-vo    253:0    0  232M  0 lvm  /reports
    ├─vdb2          252:18   0  512M  0 part 
    │ └─vgroup-swap 253:1    0  256M  0 lvm  [SWAP]
    ├─vdb3          252:19   0  756M  0 part [SWAP]
    └─vdb4          252:20   0  2.3G  0 part 
    vdc             252:32   0   10G  0 disk 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    [root@node2 ~]# pvcreate /dev/vdb4  #创建物理卷
      Physical volume "/dev/vdb4" successfully created.
    [root@node2 ~]# vgcreate -s 16M qagroup /dev/vdb4  #创建卷组
      Volume group "qagroup" successfully created
    
    [root@node2 ~]# lvcreate -l 60 -n qa qagroup  #创建逻辑卷
      Logical volume "qa" created.  
    [root@node2 ~]# mkfs.ext3 /dev/qagroup/qa #格式化逻辑卷
    mke2fs 1.45.4 (23-Sep-2019)
    Creating filesystem with 245760 4k blocks and 61440 inodes
    Filesystem UUID: 4c20ff08-a20d-48e2-83f6-3f5b3064c193
    Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376
    
    Allocating group tables: done                            
    Writing inode tables: done                            
    Creating journal (4096 blocks): done
    Writing superblocks and filesystem accounting information: done
    
    [root@node2 ~]# mkdir /mnt/qa
    
    [root@node2 ~]# lsblk
    NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    vda             252:0    0   10G  0 disk 
    ├─vda1          252:1    0    1M  0 part 
    ├─vda2          252:2    0  100M  0 part /boot/efi
    └─vda3          252:3    0  9.9G  0 part /
    vdb             252:16   0    4G  0 disk 
    ├─vdb1          252:17   0  510M  0 part 
    │ └─myvol-vo    253:0    0  232M  0 lvm  /reports
    ├─vdb2          252:18   0  512M  0 part 
    │ └─vgroup-swap 253:1    0  256M  0 lvm  [SWAP]
    ├─vdb3          252:19   0  756M  0 part [SWAP]
    └─vdb4          252:20   0  2.3G  0 part 
      └─qagroup-qa  253:2    0  960M  0 lvm  
    vdc             252:32   0   10G  0 disk 
    [root@node2 ~]# vim /etc/fstab  #设置自动挂载
    [root@node2 ~]# cat /etc/fstab | grep qa
    /dev/qagroup/qa /mnt/qa ext3 defaults 0 0
    [root@node2 ~]# mount -a
    [root@node2 ~]# lsblk
    NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    vda             252:0    0   10G  0 disk 
    ├─vda1          252:1    0    1M  0 part 
    ├─vda2          252:2    0  100M  0 part /boot/efi
    └─vda3          252:3    0  9.9G  0 part /
    vdb             252:16   0    4G  0 disk 
    ├─vdb1          252:17   0  510M  0 part 
    │ └─myvol-vo    253:0    0  232M  0 lvm  /reports
    ├─vdb2          252:18   0  512M  0 part 
    │ └─vgroup-swap 253:1    0  256M  0 lvm  [SWAP]
    ├─vdb3          252:19   0  756M  0 part [SWAP]
    └─vdb4          252:20   0  2.3G  0 part 
      └─qagroup-qa  253:2    0  960M  0 lvm  /mnt/qa
    vdc             252:32   0   10G  0 disk 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55

    创建 VDO 卷

    创建 VDO 卷
    
    根据如下要求,创建新的 VDO 卷:
    
        使用未分区的磁盘
    
        该卷的名称为 vdough
    
        该卷的逻辑大小为 50G
    
        该卷使用 xfs 文件系统格式化
    
        该卷(在系统启动时)挂载到 /vbread 下
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    [root@node2 ~]# lsblk
    NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    vda             252:0    0   10G  0 disk 
    ├─vda1          252:1    0    1M  0 part 
    ├─vda2          252:2    0  100M  0 part /boot/efi
    └─vda3          252:3    0  9.9G  0 part /
    vdb             252:16   0    4G  0 disk 
    ├─vdb1          252:17   0  510M  0 part 
    │ └─myvol-vo    253:0    0  232M  0 lvm  /reports
    ├─vdb2          252:18   0  512M  0 part 
    │ └─vgroup-swap 253:1    0  256M  0 lvm  [SWAP]
    ├─vdb3          252:19   0  756M  0 part [SWAP]
    └─vdb4          252:20   0  2.3G  0 part 
      └─qagroup-qa  253:2    0  960M  0 lvm  /mnt/qa
    vdc             252:32   0   10G  0 disk  #使用未分区的磁盘
    
    
    
    [root@node2 ~]# yum install vdo -y
    [root@node2 ~]# vdo create --name=vdough --device=/dev/vdc --vdoLogicalSize=50G
    Creating VDO vdough
          The VDO volume can address 6 GB in 3 data slabs, each 2 GB.
          It can grow to address at most 16 TB of physical storage in 8192 slabs.
          If a larger maximum size might be needed, use bigger slabs.
    Starting VDO vdough
    Starting compression on VDO vdough
    VDO instance 0 volume is ready at /dev/mapper/vdough
       # 该卷使用 xfs 文件系统格式化
    [root@node2 ~]# mkfs.xfs /dev/mapper/vdough
    meta-data=/dev/mapper/vdough     isize=512    agcount=4, agsize=3276800 blks
             =                       sectsz=4096  attr=2, projid32bit=1
             =                       crc=1        finobt=1, sparse=1, rmapbt=0
             =                       reflink=1
    data     =                       bsize=4096   blocks=13107200, imaxpct=25
             =                       sunit=0      swidth=0 blks
    naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
    log      =internal log           bsize=4096   blocks=6400, version=2
             =                       sectsz=4096  sunit=1 blks, lazy-count=1
    realtime =none                   extsz=4096   blocks=0, rtextents=0
    
    
    #挂载
    [root@node2 ~]# mkdir /vbread
    [root@node2 ~]# vim /etc/fstab
    [root@node2 ~]# mount -a
    [root@node2 ~]# df -Th /vbread/
    Filesystem         Type  Size  Used Avail Use% Mounted on
    /dev/mapper/vdough xfs    50G  390M   50G   1% /vbread
    [root@node2 ~]# lsblk
    NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    vda             252:0    0   10G  0 disk 
    ├─vda1          252:1    0    1M  0 part 
    ├─vda2          252:2    0  100M  0 part /boot/efi
    └─vda3          252:3    0  9.9G  0 part /
    vdb             252:16   0    4G  0 disk 
    ├─vdb1          252:17   0  510M  0 part 
    │ └─myvol-vo    253:0    0  232M  0 lvm  /reports
    ├─vdb2          252:18   0  512M  0 part 
    │ └─vgroup-swap 253:1    0  256M  0 lvm  [SWAP]
    ├─vdb3          252:19   0  756M  0 part [SWAP]
    └─vdb4          252:20   0  2.3G  0 part 
      └─qagroup-qa  253:2    0  960M  0 lvm  /mnt/qa
    vdc             252:32   0   10G  0 disk 
    └─vdough        253:3    0   50G  0 vdo  /vbread
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64

    配置系统调优

    配置系统调优
    
    为您的系统选择建议的 tuned 配置集并将它设为默认设置。
    
    • 1
    • 2
    • 3
    [root@node2 ~]# yum -y install tuned
    Last metadata expiration check: 0:53:38 ago on Wed 30 Aug 2023 04:57:11 PM EDT.
    Package tuned-2.13.0-6.el8.noarch is already installed.
    Dependencies resolved.
    Nothing to do.
    Complete!
    [root@node2 ~]# systemctl enable tuned
    [root@node2 ~]# systemctl restart tuned
    [root@node2 ~]# tuned-adm active
    Current active profile: throughput-performance
    [root@node2 ~]# tuned-adm recommend
    virtual-guest
    [root@node2 ~]# tuned-adm profile virtual-guest
    [root@node2 ~]# tuned-adm active
    Current active profile: virtual-guest
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
  • 相关阅读:
    AK 9.12 百度Java后端研发B卷 笔试
    SQL语句学习
    单片机——将P1口状态送入P0、P2和P3口
    AWS VPC 概述
    Gateway网关
    cesium 设置默认视图
    Nginx日志管理之访问日志配置
    VMWare 虚拟机如何扩展磁盘空间并挂载到已存在的根目录
    【杂记-浅谈OSPF协议之Hello、DD、LSR、LSU、LSAck报文】
    华纳云:负载均衡服务器的作用是什么 有哪些方式
  • 原文地址:https://blog.csdn.net/weixin_51882166/article/details/132724578