Happy Friday, everyone!
Let's wrap up the study week with a practical, hands-on scenario. This is a task you will absolutely have to perform as a sysadmin and a key skill for the RHCSA exam: extending a logical volume that's running low on space.
You've received an alert that a server is running out of disk space. Here are the details:
/dev/vg_apps/lv_data
, is mounted on /srv/appdata
.vg_apps
has plenty of free space.What are the commands you would use to safely extend both the logical volume and the XFS filesystem? Let's see your step-by-step process!
Drop your solutions in the comments. Have a fantastic weekend!
Below is the command need to be fired:
lvextend -L +5G /dev/mapper/vg_apps-lv_data
xfs_growfs /dev/mapper/vg_apps-lv_data
Thats it now verify with df -Th space will be increased from 10G to 15G online. No unmounting is required.
@Debasis_roy77 awesome, that's a solid and correct solution. Thanks for sharing!
You've laid out the classic two-step process perfectly: resize the LV, then resize the filesystem. It's safe and it works every time.
For everyone following along, have you ever seen a way to combine those two steps into a single, time-saving command? It's a useful flag to know.
You nailed the XFS part. Let's dig a little deeper on that second step: Why do we need a specific command like xfs_growfs at all? What does that tell us about what we'd need to do for a different filesystem, like ext4?
Great stuff for getting the ball rolling on this. Let's see what everyone else thinks!
For ext4, to resize mountpoint of extend LV, it would be fsadm -l resize /dev/mapper/vg_apps-lv_data instead of xfs_growfs, other wise ext4 can be done using lvextend -L -r +5G /dev/mapper/vg_apps-lv_data
fsadm will be a new thing to learn for many learners :
lvextend -L -r +5G /dev/mapper/vg_apps-lv_data
@Ben spot on ! from the lvextend man page :
-r, --resizefs Resize underlying filesystem together with the logical volume using
lvextend -L +5G /dev/vg_apps/lv_data
xfs_growfs /srv/appdata
To resize the filesystem if it was ext4 instead of XFS
-----------------------------------------------------------
lvextend -L +5G /dev/vg_apps/lv_data
resize2fs /dev/vg_apps/lv_data
df -h /srv/appdata
Thanks
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.