RHCSA Exam QuestionsBrowse all questions from this exam

RHCSA Exam - Question 18


SIMULATION -

Create a volume group, and set 8M as a extends. Divided a volume group containing 50 extends on volume group lv (lvshare), make it as ext4 file system, and mounted automatically under /mnt/data. And the size of the floating range should set between 380M and 400M.

Show Answer
Correct Answer:

To create a volume group with 8M extends and a logical volume with 50 extends, format it as ext4, and automatically mount it under /mnt/data with a size between 380M and 400M, follow these steps precisely: 1. Use fdisk to create a partition on the desired disk. 2. Use partprobe to let the kernel know about the partition table changes. 3. Initialize the partition with pvcreate. 4. Create a volume group with a physical extent size of 8M using vgcreate. 5. Create a logical volume with 50 extents using lvcreate. 6. Format the logical volume with ext4 using mkfs.ext4. 7. Create the /mnt/data directory using mkdir. 8. Edit /etc/fstab to mount the logical volume automatically by adding '/dev/vg1/lvshare /mnt/data ext4 defaults 0 0'. 9. Use mount -a to mount all filesystems mentioned in /etc/fstab. 10. Verify with df -h or lsblk. The detailed commands are: 1. fdisk 2. partprobe 3. pvcreate /dev/vda6 4. vgcreate -s 8M vg1 /dev/vda6 5. lvcreate -n lvshare -l 50 vg1 6. mkfs.ext4 /dev/vg1/lvshare 7. mkdir -p /mnt/data 8. vim /etc/fstab and add the line '/dev/vg1/lvshare /mnt/data ext4 defaults 0 0' 9. mount -a 10. df -h Ensure the logical volume is sized between 380M and 400M, which 50 extends of 8M each will satisfy (50 * 8M = 400M).

Discussion

4 comments
Sign in to comment
RedQuasar
Jun 12, 2023

vgcreate -s 8M vg02 /dev/sda3 lvcreate -l 50 -n lv02 mkfs.ext4 /dev/mapper/vg02_lv02 mkdir /mnt/data3 lsblk -pf (UUID=…457f-446bbb805753) echo “UUID=…457f-446bbb805753 /mnt/data3 ext4 defaults 0 0” >> /etc/fstab

badguy001djh
Feb 3, 2024

Your lvcreate command lacks VG option.

STFN2019
Mar 16, 2024

Yep second line should be: lvcreate -l 50 -n lv02 vg02

STFN2019
Mar 16, 2024

Yep second line should be: lvcreate -l 50 -n lv02 vg02

vira5489
May 24, 2024

-- lets say we are going to work on /dev/vda3 , make sure this disk has no mount point,if any than unmount them ex. umount /mnt/data vgcreate -s 8M vg1 /dev/vda3 lvcreate -n lvshare -l 50 vg1 mkfs.ext4 /dev/vg1/lvshare mkdir -p /mnt/data vim /etc/fstab /dev/vg1/lvshare /mnt/data ext4 defaults 0 0 mount -a partprobe df -h

xXxM__JxXx
Sep 25, 2024

hi just want to ask. what part of the command line addresses this requirement And the size of the floating range should set between 380M and 400M

kenkct
Aug 28, 2024

sudo su lsblk -psf pvcreate /dev/sd[] vgcreate -s 8M vg1 /dev/sd[] lvcreate -l 50 -n lvshare vg1 lsblk -psf mkfs.ext4 /dev/mapper/vg1-lvshare mkdir -p /mnt/data echo '/dev/mapper/vg1-lvshare /mnt/data ext4 defaults 0 0' >> /etc/fstab systemctl daemon-reload mount -a

kitkat
Dec 9, 2024

We need to set partition size between 380M and 400M

kitkat
Dec 9, 2024

50 extends of 8MB each will be close to 400MB.

kitkat
Dec 9, 2024

Which means we do not need to define anything special setting vgcreate to 8M and lvcreate extends to 50 is doing what question asks for.

kitkat
Dec 9, 2024

Which means we do not need to define anything special setting vgcreate to 8M and lvcreate extends to 50 is doing what question asks for.