ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Fedora on XenServer VM - Expand primary Partition

    IT Discussion
    fedora xenserver partition expand virtual machine
    4
    26
    3.5k
    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.
    • DustinB3403D
      DustinB3403
      last edited by DustinB3403

      So I have a Fedora VM that I need to expand the primary partition on, and I'm kind of at a loss on how to do this for this VM.

      A key point

      • the VM does not & cannot have internet access

      So how can I go about increasing the primary partition of this VM?

      1 Reply Last reply Reply Quote 0
      • coliverC
        coliver
        last edited by

        Did you set up LVM?

        DustinB3403D 1 Reply Last reply Reply Quote 0
        • DustinB3403D
          DustinB3403 @coliver
          last edited by

          @coliver I didn't build this VM so I'm uncertain of that.

          Let me investigate.

          1 Reply Last reply Reply Quote 0
          • coliverC
            coliver
            last edited by

            If you didn't it is still possible but I don't think you can do it with the system running. Do you have access to a live cd or the Fedora installer iso?

            DustinB3403D 1 Reply Last reply Reply Quote 0
            • DustinB3403D
              DustinB3403
              last edited by

              Yes LVM is active.

              0_1459522069062_XenCenterMain_2016-04-01_10-47-39.png

              1 Reply Last reply Reply Quote 0
              • DustinB3403D
                DustinB3403 @coliver
                last edited by

                @coliver I am able to mount the Fedora ISO if need be.

                1 Reply Last reply Reply Quote 0
                • stacksofplatesS
                  stacksofplates
                  last edited by stacksofplates

                  You should be able to just increase the size of the VHD. Then increase the size of the logical volume.

                  After increasing the actual VHD you should just be able to do:

                  pvresize /dev/xvda2
                  
                  vgextend fedora /dev/xvda2
                  
                  lvextend -l 100%FREE /dev/fedora/root
                  

                  If the 100%FREE doesn't work, you can check the number of extents with

                  vgdisplay
                  

                  Then just use the same number of PEs.

                  lvextend -l 4567 /dev/fedora/root
                  
                  1 Reply Last reply Reply Quote 1
                  • DustinB3403D
                    DustinB3403
                    last edited by

                    So this is what vgdisplay reports0_1459530007856_XenCenterMain_2016-04-01_12-59-33.png

                    Which appears it only has 1 PE available.

                    Which how does this make sense?

                    1 Reply Last reply Reply Quote 0
                    • stacksofplatesS
                      stacksofplates
                      last edited by

                      What does fdisk -l show?

                      1 Reply Last reply Reply Quote 0
                      • DustinB3403D
                        DustinB3403
                        last edited by

                        Performing

                        vgextend fedora /dev/xvda2 
                        

                        results in

                        "Physical volume '/dev/xvda2" is already in volume group 'fedora' unable to add physical volume to '/dev/xvda2' to volume group 'fedora' "
                        
                        1 Reply Last reply Reply Quote 0
                        • DustinB3403D
                          DustinB3403
                          last edited by

                          0_1459530217565_XenCenterMain_2016-04-01_13-03-28.png

                          1 Reply Last reply Reply Quote 0
                          • DustinB3403D
                            DustinB3403
                            last edited by

                            It's as if adding the storage to the VHD is expanding the wrong partition.

                            0_1459530316866_XenCenterMain_2016-04-01_13-04-53.png

                            stacksofplatesS 1 Reply Last reply Reply Quote 0
                            • stacksofplatesS
                              stacksofplates @DustinB3403
                              last edited by

                              @DustinB3403 said:

                              It's as if adding the storage to the VHD is expanding the wrong partition.

                              0_1459530316866_XenCenterMain_2016-04-01_13-04-53.png

                              Increasing the VHD increases the physical disk. Then you need to increase the physical volume with pvresize then extend the volume group with vgextend then the logical volume with lvextend.

                              You may need to recreate the physical partition with fdisk. I didn't think you had to with the VHD but you might need to.

                              You would run

                              fdisk /dev/xvda
                              

                              Then delete the 2nd partition and recreate it spanning the whole disk. Then expand the logical volume.

                              To do that on a root volume you would need to boot with a recovery disk.

                              1 Reply Last reply Reply Quote 0
                              • stacksofplatesS
                                stacksofplates
                                last edited by stacksofplates

                                I can't test it right now or I would be able to confirm you would need to recreate the xvda2 partition or not.

                                1 Reply Last reply Reply Quote 0
                                • stacksofplatesS
                                  stacksofplates
                                  last edited by

                                  So looks like you will need to take the root partition offline. Another option is to create a third partition with fdisk.

                                  fdisk /dev/xvda
                                  

                                  Then go through the menu to create a third partition that fills up the rest of the disk

                                  Then run vgextend /dev/xvda3

                                  Check the PEs with vgdisplay

                                  Then run lvextend -l 100%FREE (or the extent size) /dev/mapper/fedora-root (or /dev/fedora/root)

                                  1 Reply Last reply Reply Quote 0
                                  • DustinB3403D
                                    DustinB3403
                                    last edited by

                                    fdisk /dev/xvda2

                                    and 'p'
                                    0_1459532049564_upload-f2fbfadc-5f0e-4a36-9128-ed2f6fa85a19

                                    1 Reply Last reply Reply Quote 0
                                    • scottalanmillerS
                                      scottalanmiller
                                      last edited by

                                      part of thei ssue is partitions needing to be resized. You either have to grow the right partition which is often not an option or you need to let LVM handle it. In this case, just make a new partition, use pvcreate to add it under LVM, add it to the existing volume group then grow things as before.

                                      stacksofplatesS 1 Reply Last reply Reply Quote 2
                                      • DustinB3403D
                                        DustinB3403
                                        last edited by DustinB3403

                                        So as a follow up to what @johnhooks and I were working on. This is what I have. (Had to revert as something broke) This VM only has 1 VHD. Of which I'd like to either expand the boot partition, or create a new partition and then allow it to be used by the primary.

                                        0_1459542801972_XenCenterMain_2016-04-01_16-33-12.png

                                        1 Reply Last reply Reply Quote 0
                                        • DustinB3403D
                                          DustinB3403
                                          last edited by

                                          In a LiveCD now and this is what Parted has.

                                          0_1459543299525_XenCenterMain_2016-04-01_16-41-26.png

                                          1 Reply Last reply Reply Quote 0
                                          • stacksofplatesS
                                            stacksofplates @scottalanmiller
                                            last edited by stacksofplates

                                            @scottalanmiller said:

                                            part of thei ssue is partitions needing to be resized. You either have to grow the right partition which is often not an option or you need to let LVM handle it. In this case, just make a new partition, use pvcreate to add it under LVM, add it to the existing volume group then grow things as before.

                                            For some reason I thought I resized a disk and live root volume on a VM before. I guess I was dreaming.

                                            scottalanmillerS 1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post