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

    CentOS 7 guest on XS6.5 - Growing Hard Disk

    Scheduled Pinned Locked Moved IT Discussion
    9 Posts 3 Posters 920 Views
    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.
    • anthonyhA
      anthonyh
      last edited by

      In my effort to keep the size of my VMs at bay, I typically size the virtual disks to a reasonable size I feel will serve the role the VM will play. There are times where my estimate is off and I need to grow the disk. Not a big deal, I've done it many times without issue.

      This came up with a CentOS 7 VM last night. No biggie, I've done this many times. The process I use is exactly as follows:

      • Shut down the VM.
      • Extend the disk. In this case I grew the disk from 20 GB to 100 GB
      • Start the VM.
      • Run "fdisk /dev/xvda"
      • In my case there are only two partitions. /dev/xvda1 which is /boot and /dev/xvda2 which is /. So I delete /dev/xvda2
      • Recreate /dev/xvda2 making sure to utilize all available space on the disk.
      • Reboot the VM.
      • Run "pvresize /dev/xvda2".
      • Run "lvextend -l 100%FREE -r /dev/mapper/centos-root".

      When I've done this in the past, it has gone flawlessly. The physical volume expands to the added space and the logical volume then expands to the added space.

      However, this time around, it didn't exactly do that.

      The physical volume expanded completely, but the logical volume did not. I'm not sure why.

      Output of pvdisplay:

      alt text

      Output of lvdisplay:

      alt text

      If my math is correct, 2 GiB plus 67.51 GiB does not come close to the size of the physical volume (99.51 GiB).

      What am I missing?

      1 Reply Last reply Reply Quote 0
      • momurdaM
        momurda
        last edited by

        It looks like you forgot to extend the VG before resizing the LV.

        anthonyhA 2 Replies Last reply Reply Quote 0
        • anthonyhA
          anthonyh @momurda
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • anthonyhA
            anthonyh @momurda
            last edited by anthonyh

            @momurda From what I understand, vgextend is for adding additional volumes to the group. I simply grew the size of the existing volume. When doing this, I haven't ever had to touch anything related to the VG. Besides, if that was the case, wouldn't the LV not grow at all? It most certainly grew from it's original ~18 GiB (don't know what it was in GiB exactly, but it was 18 GB for sure) to the current 67.51 GiB

            1 Reply Last reply Reply Quote 1
            • momurdaM
              momurda
              last edited by

              What is the output of lsblk fdisk -l and vgdisplay

              anthonyhA 1 Reply Last reply Reply Quote 0
              • anthonyhA
                anthonyh @momurda
                last edited by anthonyh

                @momurda

                lsblk output:

                0_1504126610325_Selection_124.png

                fdisk -l output:

                0_1504126617241_Selection_125.png

                vgdisplay output:

                0_1504126626307_Selection_126.png

                1 Reply Last reply Reply Quote 0
                • momurdaM
                  momurda
                  last edited by

                  I would try this
                  lvextend -l +100%FREE /dev/mapper/centos-root
                  Your vg still has 30GB unallocated. Not sure why

                  anthonyhA 1 Reply Last reply Reply Quote 2
                  • anthonyhA
                    anthonyh @momurda
                    last edited by anthonyh

                    @momurda Huh.

                    lvextend -l +100%FREE -r /dev/mapper/centos-root

                    Seems to have done it.

                    I swear I ran the command multiple times. I suspect I was missing the "+" on "+100%FREE". I wonder what the difference is?

                    travisdh1T 1 Reply Last reply Reply Quote 2
                    • travisdh1T
                      travisdh1 @anthonyh
                      last edited by

                      @anthonyh said in CentOS 7 guest on XS6.5 - Growing Hard Disk:

                      @momurda Huh.

                      lvextend -l +100%FREE -r /dev/mapper/centos-root

                      Seems to have done it.

                      I swear I ran the command multiple times. I suspect I was missing the "+" on "+100%FREE". I wonder what the difference is?

                      When creating an logical volume, you tell it how much space to use. While when making a change to the logical volume you need to tell it how much to add or remove. Thus the + or - when using lvchange, but not needed with lvcreate.

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