Contents

RHCSA - 模擬考 - 創建及設定 LVM

題目

在 Server B 上設定 :

  • 創建 Lvm 為 qa 並屬於 qagroup 的群組,並由 10 個 PE 組合。
  • qagroup 每一個 PE SIZE 為 16MiB 。
  • 使用 ext3 格式化其 LVM ,並且開機後能自動掛載至 /mnt/qa 。
提示
  • vgcreate 創建加上 -s 參數可以自行定義 PE size 大小。

參考作法

  1. man 相關手冊 -> pvcreate、 vgcreate、 lvcreate、 mkfs、 mount。

參考解答

 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
[root@serverb ~]# pvcreate /dev/vdb
  Physical volume "/dev/vdb" successfully created.
[root@serverb ~]# vgcreate -s 16Mib qagroup /dev/vdb
  Volume group "qagroup" successfully created
[root@serverb ~]# vgdisplay qagroup
  --- Volume group ---
  VG Name               qagroup
...output omitted...
  VG Size               49.98 GiB
  PE Size               16.00 MiB
...output omitted...

[root@serverb ~]# lvcreate -l 10 --name qa qagroup
  Logical volume "qa" created.
[root@serverb ~]# lvdisplay qagroup/qa
  --- Logical volume ---
  LV Path                /dev/qagroup/qa
...output omitted...
  # open                 0
  LV Size                160.00 MiB
...output omitted...

[root@serverb ~]# mkfs.ext3 /dev/qagroup/qa
mke2fs 1.45.6 (20-Mar-2020)
Discarding device blocks: done
Creating filesystem with 163840 1k blocks and 40960 inodes
...output omitted...
[root@serverb ~]# mkdir -p /mnt/qa
[root@serverb ~]# cat >> /etc/fstab <<EOF
/dev/mapper/qagroup-qa /mnt/qa ext3 defaults 0 0
EOF
[root@serverb ~]# df -h /mnt/qa
Filesystem              Size  Used Avail Use% Mounted on
/dev/mapper/qagroup-qa  150M   31K  142M   1% /mnt/qa


如果你還沒有註冊 Like Coin,你可以在文章最下方看到 Like 的按鈕,點下去後即可申請帳號,透過申請帳號後可以幫我的文章按下 Like,而 Like 最多可以點五次,而你不用付出任何一塊錢,就能給我寫這篇文章的最大的回饋!