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

    Attempting to increase the size of a Linux LVM Disk

    Scheduled Pinned Locked Moved IT Discussion
    40 Posts 5 Posters 2.3k 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.
    • wirestyle22W
      wirestyle22
      last edited by wirestyle22

      #assign filesystem to disk
      mkfs.ext3 /dev/xvdb 2>/dev/null
      mount /dev/xvdc /mnt -t auto

      b16MOmA.jpg

      Now I want to allocate the space in /dev/xvdb to centos-root. What would be the best way to do that? My first instinct is to shrink /dev/xvdb and then apply whatever space I saved to centos-root but I'm doubting that's the best way to do it.

      1 Reply Last reply Reply Quote 0
      • RamblingBipedR
        RamblingBiped
        last edited by RamblingBiped

        If you're wanting to add this to an already existing logical volume you don't need to do anything with the file system at first. You need to add the new physical volume to the volume group that your existing logical volume is on. Once that physical volume has been added to the volume group you can extend the logical volume and increase it's size. At that point you can grow the file system to occupy the newly allocated space.

        Here's an article that should help walk you through the process if you're not familiar: http://www.tecmint.com/extend-and-reduce-lvms-in-linux/

        wirestyle22W 1 Reply Last reply Reply Quote 1
        • wirestyle22W
          wirestyle22 @RamblingBiped
          last edited by wirestyle22

          @RamblingBiped So I can unmount it and delete the virtual disk then recreate to start over, correct?

          RamblingBipedR 1 Reply Last reply Reply Quote 0
          • RamblingBipedR
            RamblingBiped @wirestyle22
            last edited by

            @wirestyle22 I think that should work. As long as you can see the disk you should be able to use LVM's pvcreate to create a physical volume and then add that volume to the volume group that is associated with your logical volume.

            pvs and pvdisplay will show pertinent information in regards to your LVM physical volumes.

            vgs and vgdisplay will show volume group information.

            lvs and lvdisplay will show logical volume information.

            wirestyle22W 1 Reply Last reply Reply Quote 2
            • wirestyle22W
              wirestyle22 @RamblingBiped
              last edited by wirestyle22

              @RamblingBiped So I can see that both Logical Volumes and Physical Volumes are added.

              0_1490249273919_vgs.JPG

              The question now is how to add the VFree space to dev/mapper/centos-root

              0_1490249346826_Capture10.JPG

              RamblingBipedR 1 Reply Last reply Reply Quote 0
              • RamblingBipedR
                RamblingBiped @wirestyle22
                last edited by

                @wirestyle22 Did you do an lvextend on the logical volume that you are wanting to add the extra storage space to?

                1 Reply Last reply Reply Quote 1
                • RamblingBipedR
                  RamblingBiped
                  last edited by

                  @wirestyle22 said in Attempting to increase the size of a Linux LVM Disk:

                  The question now is how to add the VFree space to dev/mapper/centos-root

                  So if you do a vgs command it should show your volume group with your newly increased capacity. When you do a lvs it should show your logical volumes (probably root and swap). You'll want to do a lvextend on your root logical volume to add the newly allocated space on the volume group to that logical volume.

                  The article I linked you previously should give a good example of that command. Google-fu will result in some official redhat documentation that will do a good job of walking you through it too.

                  Once you've extended your logical volume you'll just need to expand the filesystem to occupy the space. After that you should be all set.

                  1 Reply Last reply Reply Quote 1
                  • RamblingBipedR
                    RamblingBiped
                    last edited by RamblingBiped

                    Growing Logical Volumes: https://www.centos.org/docs/5/html/Cluster_Logical_Volume_Manager/lv_extend.html

                    https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Logical_Volume_Manager_Administration/lv_extend.html

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

                      Let's see if I can remember this without looking anything up this time...

                      pvcreate /dev/new_drive
                      vgextend vg_name /dev/new_drive
                      lvextend lv_name -l 100%FREE
                      

                      Dang, I forget the ones to extend the file system 😞

                      wirestyle22W 1 Reply Last reply Reply Quote 0
                      • wirestyle22W
                        wirestyle22 @travisdh1
                        last edited by wirestyle22

                        @travisdh1 My problem is LVS and VGS displays the right amout of space.PVS displays two PV's in the same VG, both at 1.95TB but nothing is listed as VFree.

                        vgs
                        0_1490308997512_Capture14.JPG

                        lvs
                        0_1490308961419_Capture13.JPG

                        pvs
                        0_1490308919558_Capture12.JPG

                        df -h
                        0_1490308770233_Capture11.JPG

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

                          Have you expanded the filesystem yet?

                          wirestyle22W 1 Reply Last reply Reply Quote 0
                          • wirestyle22W
                            wirestyle22 @scottalanmiller
                            last edited by wirestyle22

                            @scottalanmiller

                            resize2fs /dev/mapper/centos-root

                            [root@localhost ~]# resize2fs /dev/mapper/centos-root 3.91T
                            resize2fs 1.42.9 (28-Dec-2013)
                            resize2fs: Bad magic number in super-block while trying to open /dev/mapper/centos-root
                            Couldn't find valid filesystem superblock.

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

                              That's not good. Try it with the -p flag.

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

                                What filesystem do you have? Could it be XFS?

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

                                  If XFS the command syntax is...

                                  xfs_growfs /mount/point -D size
                                  
                                  1 Reply Last reply Reply Quote 0
                                  • scottalanmillerS
                                    scottalanmiller
                                    last edited by

                                    It's XenServer, we are expecting EXT4 here, right?

                                    wirestyle22W 1 Reply Last reply Reply Quote 0
                                    • wirestyle22W
                                      wirestyle22 @scottalanmiller
                                      last edited by wirestyle22

                                      @scottalanmiller Correct

                                      1 Reply Last reply Reply Quote 0
                                      • wirestyle22W
                                        wirestyle22
                                        last edited by wirestyle22

                                        Is this improper syntax?

                                        0_1490310743055_whatever.JPG

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

                                          @wirestyle22 said in Attempting to increase the size of a Linux LVM Disk:

                                          Is this improper syntax?

                                          0_1490310743055_whatever.JPG

                                          Try +3.91.

                                          Also, why not have the data on its own volume? It's more flexible that way.

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

                                            If the +doesn't work you will have to add it to the existing size. So if its 5TB it would be 8.91

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