RHCSA Practical Lab Series β Resizing Logical Volumes
π Lab 18: Adjusting Logical Volume Size in RHEL 9
π Objective
In this lab, you will:
β Resize an existing logical volume (LV) named vo
β Expand the LV to 239 MB
β Resize the filesystem to match the new volume size
β Verify that the new size is applied correctly
π Step 1: Scan for Available Logical Volumes
πΉ List all existing volume groups and logical volumes:
[root@node2 ~]# lvscan
π Expected Output (Example):
ACTIVE '/dev/myvol/vo' [213.00 MiB] inherit
β
Ensure that /dev/myvol/vo
is active before resizing.
π Step 2: Extend the Logical Volume
πΉ Increase the LV size to 239 MB:
[root@node2 ~]# lvextend -L 239M /dev/myvol/vo
π Explanation:
lvextend
β Command to increase LV size.-L 239M
β Sets the size to exactly 239 MB./dev/myvol/vo
β The logical volume being resized.
β If successful, you will see:
Size of logical volume myvol/vo changed from 213.00 MiB to 239.00 MiB.
Logical volume myvol/vo successfully resized.
π Step 3: Verify the Updated Logical Volume Size
πΉ Check the new size of the LV:
[root@node2 ~]# blkid /dev/myvol/vo
β The output should reflect the new size.
π Step 4: Resize the Filesystem
πΉ Adjust the filesystem to match the new LV size:
[root@node2 ~]# resize2fs /dev/myvol/vo
π Explanation:
resize2fs
β Resizes the filesystem on an ext4/xfs partition./dev/myvol/vo
β The logical volume being modified.
β Expected Output:
Filesystem at /dev/myvol/vo is now 239M blocks long.
π Step 5: Verify the Updated Filesystem Size
πΉ Check available disk space:
[root@node2 ~]# df -h
π Expected Output:
Filesystem Size Used Avail Use% Mounted on
/dev/myvol/vo 239M 100M 139M 43% /mnt/data
β
If the size matches 239M
, the resizing was successful!
π Troubleshooting Tips
πΉ If resize2fs
fails, check the filesystem type:
[root@node2 ~]# df -T /dev/myvol/vo
- If it is ext4, continue using
resize2fs
.
If it is XFS, use:
xfs_growfs /dev/myvol/vo
πΉ If lvextend
fails due to insufficient space, check free space in the volume group:
[root@node2 ~]# vgdisplay myvol | grep Free
β Ensure there is enough free space before extending the LV.
β Final Summary
β Scanned available logical volumes
β Increased the LV size to 239 MB
β Resized the filesystem to match
β Verified the new size using df -h
π Next Lab: Configuring a Swap Partition in RHEL 9
π© Subscribe for more RHCSA exam labs and hands-on tutorials! π