How to Extend LVM After Increasing Hard Drive in XO?
-
Hi,
I increased the hard drive size for a VM in XO:
But I can't figure out how to tell the OS (AlmaLinux 9.4.x) which uses LVM about the increase in hard drive capacity that I did via XO:
I know I could have just added a new HD via XO and then created a new PV, add it to the existing LV and extend it. However, I'm not sure how others use the XO disk size change to grow a linux OS LVM.
fdisk does show the new hard drive capacity of 40GB for /dev/xvda but I can't edit the while the OS is running which I was hoping to do w/ using LVM to extend partition without having to boot w/ LIVE CD:
Best Regards,SW
-
@stevewest15 This is how I've managed it in the past --
sudo fdisk /dev/xvda D N W Sudo reboot sudo resize2fs /dev/xvda2
This is based on the answer found here.
-
@Danp Deleting and then re-creating doesnt always work if there's another partition (swap) after.
I usually do this:fdisk -l /dev/xvda (note the end blocks of the last partition under the End column)
fdisk /dev/xvda
n
accept the defaults except starting blocks (use next free block as starting block)
w
vgextend almalinux /dev/xvda3 (if thats the number you saw when creating the new partition)
lvresize /dev/template-vg/almalinux-root -l +100%FREE -r