XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    How to Extend LVM After Increasing Hard Drive in XO?

    Scheduled Pinned Locked Moved Xen Orchestra
    3 Posts 3 Posters 697 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      stevewest15
      last edited by stevewest15

      Hi,

      I increased the hard drive size for a VM in XO:

      40a42a1b-df07-40b9-8030-598134187953-image.png

      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:

      8343e81e-f40e-4b00-af32-22840dae0dfd-image.png

      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:

      97656fe0-276f-4da4-bfe5-9540a1132e36-image.png
      86413fa2-cd83-4180-ba20-9c6a79565426-image.png
      Best Regards,

      SW

      DanpD 1 Reply Last reply Reply Quote 0
      • DanpD Offline
        Danp Pro Support Team @stevewest15
        last edited by

        @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.

        nikadeN 1 Reply Last reply Reply Quote 0
        • nikadeN Offline
          nikade Top contributor @Danp
          last edited by

          @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

          1 Reply Last reply Reply Quote 0
          • First post
            Last post