0%

RHCSA (EX200) - 创建逻辑卷

创建逻辑卷

根据如下要求,创建新的逻辑卷:

逻辑卷取名为 qa,属于 qagroup 卷组,大小为 60 个扩展块

qagroup 卷组中逻辑卷的扩展块大小应当为 16 MiB

使用 ext3 文件系统格式化新逻辑卷。该逻辑卷应在系统启动时自动挂载到 /mnt/qa

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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
[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 ~]# pvcreate /dev/vdb4
Physical volume "/dev/vdb4" successfully created.
[root@node2 ~]# vgcreate qagroup /dev/vdb4 -s 16m
Volume group "qagroup" successfully created
[root@node2 ~]# vgdisplay qagroup
--- Volume group ---
VG Name qagroup
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 2.25 GiB
PE Size 16.00 MiB
Total PE 144
Alloc PE / Size 60 / 960.00 MiB
Free PE / Size 84 / 1.31 GiB
VG UUID HesSpg-CsMU-Dckq-Oydn-cUmK-cc3o-ddDJEW

[root@node2 ~]# lvcreate qagroup -l 60 -n qa
Logical volume "qa" created.
[root@node2 ~]# lvdisplay /dev/qagroup/qa
--- Logical volume ---
LV Path /dev/qagroup/qa
LV Name qa
VG Name qagroup
LV UUID WsfmKz-HKza-UrPO-CbBg-LkLH-GTwg-LOUkEk
LV Write Access read/write
LV Creation host, time node2.domain250.example.com, 2023-02-19 12:52:20 -0500
LV Status available
# open 0
LV Size 960.00 MiB
Current LE 60
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:2

[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: 2ea0bb6b-a006-4b79-a181-3a8236f1d920
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 ~]# lsblk --fs
NAME FSTYPE LABEL UUID MOUNTPOINT
...
vdb
...
└─vdb4 LVM2_member xiO2Ji-56zW-TaDP-nH6B-3mCW-4rmL-WumxrZ
└─qagroup-qa ext3 2ea0bb6b-a006-4b79-a181-3a8236f1d920
vdc
[root@node2 ~]# mkdir -p /mnt/qa
[root@node2 ~]# vim /etc/fstab
...
/dev/qagroup/qa /mnt/qa ext3 defaults 0 0
[root@node2 ~]# systemctl daemon-reload
[root@node2 ~]# mount /mnt/qa
[root@node2 ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
...
/dev/mapper/qagroup-qa ext3 929M 1.2M 880M 1% /mnt/qa