RHCSA Practical Lab Series – Resizing Logical Volumes

Expertise in Cloud, Networking & DevOps
Photo by NASA / Unsplash

πŸ” 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! πŸš€


Read more