How to increase KVM guest disk size using LVM VG as storage pool?KVM guest doesn't recognize new size of raw disk after lvresizeHow do I investigate an unresponsive KVM guest?KVM/qemu - use LVM volumes directly without image file?How to decrease the size of a KVM virtual machine disk image?KVM Windows 7 graphics performance using remote desktopCentOS Qemu+KVM lot of virtual machine processesInstalling Windows on KVM with LVM diskHow to make data up to date on a shareable disk connected to KVM guest?VM performance difference after moving to different ProxMox instanceDisadvantages of creating a volume with lvm instead of with libvirt? Storage pool presentHow to get a virtio disk to show up - kernel config

Electricity free spaceship

Is it possible to have 2 different but equal size real number sets that have the same mean and standard deviation?

Generate basis elements of the Steenrod algebra

Reactive Programming

Can I utilise a baking stone to make crepes?

If there's something that implicates the president why is there then a national security issue? (John Dowd)

Which is the better way to call a method that is only available to one class that implements an interface but not the other one?

Non-aqueous eyes?

I have a problematic assistant manager, but I can't fire him

Why not invest in precious metals?

Why does this query, missing a FROM clause, not error out?

Is using 'echo' to display attacker-controlled data on the terminal dangerous?

Longest bridge/tunnel that can be cycled over/through?

Should I put programming books I wrote a few years ago on my resume?

If I leave the US through an airport, do I have to return through the same airport?

Write a function that checks if a string starts with or contains something

Is an entry level DSLR going to shoot nice portrait pictures?

A map of non-pathological topology?

What is the color of artificial intelligence?

Has there been a multiethnic Star Trek character?

Does putting salt first make it easier for attacker to bruteforce the hash?

The Frozen Wastes

60s or 70s novel about Empire of Man making 1st contact with 1st discovered alien race

How to communicate to my GM that not being allowed to use stealth isn't fun for me?



How to increase KVM guest disk size using LVM VG as storage pool?


KVM guest doesn't recognize new size of raw disk after lvresizeHow do I investigate an unresponsive KVM guest?KVM/qemu - use LVM volumes directly without image file?How to decrease the size of a KVM virtual machine disk image?KVM Windows 7 graphics performance using remote desktopCentOS Qemu+KVM lot of virtual machine processesInstalling Windows on KVM with LVM diskHow to make data up to date on a shareable disk connected to KVM guest?VM performance difference after moving to different ProxMox instanceDisadvantages of creating a volume with lvm instead of with libvirt? Storage pool presentHow to get a virtio disk to show up - kernel config






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















The KVM host server is running CentOS 6.5 and a LVM volume group "storage_pool" is used as the main storage pool for KVM.



An Ubuntu guest is installed using an ext4 filesystem and mounts the whole /dev/vda1 as /. This is the guest disk configuration:



<disk type='block' device='disk'>
<driver name='qemu' type='raw' cache='none' io='native'/>
<source dev='/dev/storage_pool/kvmguest.img'/>
<target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>


What would be the best approach to increase the guest disk size? The VG has a lot of free space.



I have found some examples but most use LVM inside the guests as well, or weren't completely applicable. As far as I understand, the common method is to create a larger LV in the same VG, shutdown the guest, transfer the data, edit the configuration to use the new LV?



Thanks in advance for any suggestions or pointers










share|improve this question




























    1















    The KVM host server is running CentOS 6.5 and a LVM volume group "storage_pool" is used as the main storage pool for KVM.



    An Ubuntu guest is installed using an ext4 filesystem and mounts the whole /dev/vda1 as /. This is the guest disk configuration:



    <disk type='block' device='disk'>
    <driver name='qemu' type='raw' cache='none' io='native'/>
    <source dev='/dev/storage_pool/kvmguest.img'/>
    <target dev='vda' bus='virtio'/>
    <alias name='virtio-disk0'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>


    What would be the best approach to increase the guest disk size? The VG has a lot of free space.



    I have found some examples but most use LVM inside the guests as well, or weren't completely applicable. As far as I understand, the common method is to create a larger LV in the same VG, shutdown the guest, transfer the data, edit the configuration to use the new LV?



    Thanks in advance for any suggestions or pointers










    share|improve this question
























      1












      1








      1


      3






      The KVM host server is running CentOS 6.5 and a LVM volume group "storage_pool" is used as the main storage pool for KVM.



      An Ubuntu guest is installed using an ext4 filesystem and mounts the whole /dev/vda1 as /. This is the guest disk configuration:



      <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source dev='/dev/storage_pool/kvmguest.img'/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
      </disk>


      What would be the best approach to increase the guest disk size? The VG has a lot of free space.



      I have found some examples but most use LVM inside the guests as well, or weren't completely applicable. As far as I understand, the common method is to create a larger LV in the same VG, shutdown the guest, transfer the data, edit the configuration to use the new LV?



      Thanks in advance for any suggestions or pointers










      share|improve this question














      The KVM host server is running CentOS 6.5 and a LVM volume group "storage_pool" is used as the main storage pool for KVM.



      An Ubuntu guest is installed using an ext4 filesystem and mounts the whole /dev/vda1 as /. This is the guest disk configuration:



      <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source dev='/dev/storage_pool/kvmguest.img'/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
      </disk>


      What would be the best approach to increase the guest disk size? The VG has a lot of free space.



      I have found some examples but most use LVM inside the guests as well, or weren't completely applicable. As far as I understand, the common method is to create a larger LV in the same VG, shutdown the guest, transfer the data, edit the configuration to use the new LV?



      Thanks in advance for any suggestions or pointers







      kvm-virtualization lvm disk-space-utilization






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 12 '14 at 16:39









      f10bitf10bit

      10615




      10615




















          4 Answers
          4






          active

          oldest

          votes


















          1














          There is no need to shutdown the guest (at least no longer in 2019).



          Simply



          lvextend -L+<size>G /dev/<group>/<volume>



          then



          virsh blockresize <domain> /dev/<group>/<volume> --size <newsize>



          and finally go into your guest and do whatever is necessary in your guest to make use of the extra space.



          In a Windows guest you can do



          diskpart



          list volume



          select volume <n>



          extend



          These are the exact steps I followed to expand the C: drive of a Windows 10 guest running as KVM domain under Ubuntu 19.04 with qemu 3.1.0






          share|improve this answer






























            0














            Searching for the same thing, I found your question with no answers yet.
            For me, the following thing has worked:



            1. shut down the guest (in my case, a debian 7.0) in the usual way.



            2. extend the "original" LV (in the host's VG, of course), e.g., by 5G. For this, you have to be root/sudo on the host:



              lvextend -L +5G /dev/YourStoragePoolVG/YourVirtualMachinesVGToExtend




            3. Open the newly extended lv (i.e., the "disk" of your VM) in gparted:



              gparted /dev/mapper/YourStoragePoolVG-YourVirtualMachinesVGToExtend




            • Note: You must use the "/dev/mapper/..." path,
              not "/dev/dm-77" or "/dev/YourStoragePoolVG/..."
              or other (this seems to be a bug/feature of LVM)!



            1. Fiddle around the partitions on the modified volume (use the GUI as usually)


            • Note: Consider the warnings about data loss, fs types etc.!

            • Note: Be careful.

            • In gparted, you can resize partitions and move them around in the partition table stored on the virtio disk within the LV.

            • Extending one or more partitions is IMHO not a problem. For partition/fs shrinking, use Google...

            • gparted also adapts the filesystems on the partitions (not only the partitions themselves.



            1. Restart your VM. It now sees the modified partitions.

            As I said, this worked for me (I could try this on some toy installation without taking risks). Could somebody please review the above instruction and comment if this works in general? Thankyou.






            share|improve this answer






























              0














              This is the procedure I went with:




              1. Extend the logical volume of the kvm guest



                # lvextend -L+50G /dev/storage_pool/guest.img



              2. Shutdown the kvm guest and deactivate the logical volume



                # virsh shutdown guest
                # lvchange -a n /dev/storage_pool/guest.img



              3. List and note the partition information of the kvm guest, most importantly the first sector. If it doesn't display sectors you may need to add the '-u' or '-u sectors' switch



                # fdisk -l /dev/storage_pool/guest.img



              4. Delete and recreate the partition to fill the whole extended space, make sure you are using sectors as units and to select the same first sector (usually 2048 if partition is aligned), you can use the 'u' fdisk command to toggle between units



                # fdisk /dev/storage_pool/guest.img
                Command (m for help): d
                Partition number (1-4): 1
                Command (m for help): n
                Command action
                e extended
                p primary partition (1-4)
                p
                Partition number (1-4): 1
                First sector (...): 2048
                Last sector...: hit enter and use the default last sector
                Command (m for help): a
                Partition number (1-4): 1
                Command (m for help): w



              5. Expose the ext3/4 filesystem and resize it



                # kpartx -a -v /dev/storage_pool/guest.img
                # e2fsck -p -f /dev/mapper/storage_pool-guest.img1
                # resize2fs /dev/mapper/storage_pool-guest.img1
                # e2fsck -p -f /dev/mapper/storage_pool-guest.img1
                # kpartx -d -v /dev/storage_pool/guest.img



              6. Activate the logical volume and start the kvm guest



                # lvchange -a y /dev/storage_pool/guest.img
                # virsh start guest






              share|improve this answer






























                0














                Anyone who looking for an answer for this question, need to check out this:



                KVM guest doesn't recognize new size of raw disk after lvresize



                I think virsh blockreisze is much better than fdisk or parted.






                share|improve this answer

























                  Your Answer








                  StackExchange.ready(function()
                  var channelOptions =
                  tags: "".split(" "),
                  id: "2"
                  ;
                  initTagRenderer("".split(" "), "".split(" "), channelOptions);

                  StackExchange.using("externalEditor", function()
                  // Have to fire editor after snippets, if snippets enabled
                  if (StackExchange.settings.snippets.snippetsEnabled)
                  StackExchange.using("snippets", function()
                  createEditor();
                  );

                  else
                  createEditor();

                  );

                  function createEditor()
                  StackExchange.prepareEditor(
                  heartbeatType: 'answer',
                  autoActivateHeartbeat: false,
                  convertImagesToLinks: true,
                  noModals: true,
                  showLowRepImageUploadWarning: true,
                  reputationToPostImages: 10,
                  bindNavPrevention: true,
                  postfix: "",
                  imageUploader:
                  brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                  contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                  allowUrls: true
                  ,
                  onDemand: true,
                  discardSelector: ".discard-answer"
                  ,immediatelyShowMarkdownHelp:true
                  );



                  );













                  draft saved

                  draft discarded


















                  StackExchange.ready(
                  function ()
                  StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f594588%2fhow-to-increase-kvm-guest-disk-size-using-lvm-vg-as-storage-pool%23new-answer', 'question_page');

                  );

                  Post as a guest















                  Required, but never shown

























                  4 Answers
                  4






                  active

                  oldest

                  votes








                  4 Answers
                  4






                  active

                  oldest

                  votes









                  active

                  oldest

                  votes






                  active

                  oldest

                  votes









                  1














                  There is no need to shutdown the guest (at least no longer in 2019).



                  Simply



                  lvextend -L+<size>G /dev/<group>/<volume>



                  then



                  virsh blockresize <domain> /dev/<group>/<volume> --size <newsize>



                  and finally go into your guest and do whatever is necessary in your guest to make use of the extra space.



                  In a Windows guest you can do



                  diskpart



                  list volume



                  select volume <n>



                  extend



                  These are the exact steps I followed to expand the C: drive of a Windows 10 guest running as KVM domain under Ubuntu 19.04 with qemu 3.1.0






                  share|improve this answer



























                    1














                    There is no need to shutdown the guest (at least no longer in 2019).



                    Simply



                    lvextend -L+<size>G /dev/<group>/<volume>



                    then



                    virsh blockresize <domain> /dev/<group>/<volume> --size <newsize>



                    and finally go into your guest and do whatever is necessary in your guest to make use of the extra space.



                    In a Windows guest you can do



                    diskpart



                    list volume



                    select volume <n>



                    extend



                    These are the exact steps I followed to expand the C: drive of a Windows 10 guest running as KVM domain under Ubuntu 19.04 with qemu 3.1.0






                    share|improve this answer

























                      1












                      1








                      1







                      There is no need to shutdown the guest (at least no longer in 2019).



                      Simply



                      lvextend -L+<size>G /dev/<group>/<volume>



                      then



                      virsh blockresize <domain> /dev/<group>/<volume> --size <newsize>



                      and finally go into your guest and do whatever is necessary in your guest to make use of the extra space.



                      In a Windows guest you can do



                      diskpart



                      list volume



                      select volume <n>



                      extend



                      These are the exact steps I followed to expand the C: drive of a Windows 10 guest running as KVM domain under Ubuntu 19.04 with qemu 3.1.0






                      share|improve this answer













                      There is no need to shutdown the guest (at least no longer in 2019).



                      Simply



                      lvextend -L+<size>G /dev/<group>/<volume>



                      then



                      virsh blockresize <domain> /dev/<group>/<volume> --size <newsize>



                      and finally go into your guest and do whatever is necessary in your guest to make use of the extra space.



                      In a Windows guest you can do



                      diskpart



                      list volume



                      select volume <n>



                      extend



                      These are the exact steps I followed to expand the C: drive of a Windows 10 guest running as KVM domain under Ubuntu 19.04 with qemu 3.1.0







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered May 24 at 19:30









                      Colin 't HartColin 't Hart

                      219113




                      219113























                          0














                          Searching for the same thing, I found your question with no answers yet.
                          For me, the following thing has worked:



                          1. shut down the guest (in my case, a debian 7.0) in the usual way.



                          2. extend the "original" LV (in the host's VG, of course), e.g., by 5G. For this, you have to be root/sudo on the host:



                            lvextend -L +5G /dev/YourStoragePoolVG/YourVirtualMachinesVGToExtend




                          3. Open the newly extended lv (i.e., the "disk" of your VM) in gparted:



                            gparted /dev/mapper/YourStoragePoolVG-YourVirtualMachinesVGToExtend




                          • Note: You must use the "/dev/mapper/..." path,
                            not "/dev/dm-77" or "/dev/YourStoragePoolVG/..."
                            or other (this seems to be a bug/feature of LVM)!



                          1. Fiddle around the partitions on the modified volume (use the GUI as usually)


                          • Note: Consider the warnings about data loss, fs types etc.!

                          • Note: Be careful.

                          • In gparted, you can resize partitions and move them around in the partition table stored on the virtio disk within the LV.

                          • Extending one or more partitions is IMHO not a problem. For partition/fs shrinking, use Google...

                          • gparted also adapts the filesystems on the partitions (not only the partitions themselves.



                          1. Restart your VM. It now sees the modified partitions.

                          As I said, this worked for me (I could try this on some toy installation without taking risks). Could somebody please review the above instruction and comment if this works in general? Thankyou.






                          share|improve this answer



























                            0














                            Searching for the same thing, I found your question with no answers yet.
                            For me, the following thing has worked:



                            1. shut down the guest (in my case, a debian 7.0) in the usual way.



                            2. extend the "original" LV (in the host's VG, of course), e.g., by 5G. For this, you have to be root/sudo on the host:



                              lvextend -L +5G /dev/YourStoragePoolVG/YourVirtualMachinesVGToExtend




                            3. Open the newly extended lv (i.e., the "disk" of your VM) in gparted:



                              gparted /dev/mapper/YourStoragePoolVG-YourVirtualMachinesVGToExtend




                            • Note: You must use the "/dev/mapper/..." path,
                              not "/dev/dm-77" or "/dev/YourStoragePoolVG/..."
                              or other (this seems to be a bug/feature of LVM)!



                            1. Fiddle around the partitions on the modified volume (use the GUI as usually)


                            • Note: Consider the warnings about data loss, fs types etc.!

                            • Note: Be careful.

                            • In gparted, you can resize partitions and move them around in the partition table stored on the virtio disk within the LV.

                            • Extending one or more partitions is IMHO not a problem. For partition/fs shrinking, use Google...

                            • gparted also adapts the filesystems on the partitions (not only the partitions themselves.



                            1. Restart your VM. It now sees the modified partitions.

                            As I said, this worked for me (I could try this on some toy installation without taking risks). Could somebody please review the above instruction and comment if this works in general? Thankyou.






                            share|improve this answer

























                              0












                              0








                              0







                              Searching for the same thing, I found your question with no answers yet.
                              For me, the following thing has worked:



                              1. shut down the guest (in my case, a debian 7.0) in the usual way.



                              2. extend the "original" LV (in the host's VG, of course), e.g., by 5G. For this, you have to be root/sudo on the host:



                                lvextend -L +5G /dev/YourStoragePoolVG/YourVirtualMachinesVGToExtend




                              3. Open the newly extended lv (i.e., the "disk" of your VM) in gparted:



                                gparted /dev/mapper/YourStoragePoolVG-YourVirtualMachinesVGToExtend




                              • Note: You must use the "/dev/mapper/..." path,
                                not "/dev/dm-77" or "/dev/YourStoragePoolVG/..."
                                or other (this seems to be a bug/feature of LVM)!



                              1. Fiddle around the partitions on the modified volume (use the GUI as usually)


                              • Note: Consider the warnings about data loss, fs types etc.!

                              • Note: Be careful.

                              • In gparted, you can resize partitions and move them around in the partition table stored on the virtio disk within the LV.

                              • Extending one or more partitions is IMHO not a problem. For partition/fs shrinking, use Google...

                              • gparted also adapts the filesystems on the partitions (not only the partitions themselves.



                              1. Restart your VM. It now sees the modified partitions.

                              As I said, this worked for me (I could try this on some toy installation without taking risks). Could somebody please review the above instruction and comment if this works in general? Thankyou.






                              share|improve this answer













                              Searching for the same thing, I found your question with no answers yet.
                              For me, the following thing has worked:



                              1. shut down the guest (in my case, a debian 7.0) in the usual way.



                              2. extend the "original" LV (in the host's VG, of course), e.g., by 5G. For this, you have to be root/sudo on the host:



                                lvextend -L +5G /dev/YourStoragePoolVG/YourVirtualMachinesVGToExtend




                              3. Open the newly extended lv (i.e., the "disk" of your VM) in gparted:



                                gparted /dev/mapper/YourStoragePoolVG-YourVirtualMachinesVGToExtend




                              • Note: You must use the "/dev/mapper/..." path,
                                not "/dev/dm-77" or "/dev/YourStoragePoolVG/..."
                                or other (this seems to be a bug/feature of LVM)!



                              1. Fiddle around the partitions on the modified volume (use the GUI as usually)


                              • Note: Consider the warnings about data loss, fs types etc.!

                              • Note: Be careful.

                              • In gparted, you can resize partitions and move them around in the partition table stored on the virtio disk within the LV.

                              • Extending one or more partitions is IMHO not a problem. For partition/fs shrinking, use Google...

                              • gparted also adapts the filesystems on the partitions (not only the partitions themselves.



                              1. Restart your VM. It now sees the modified partitions.

                              As I said, this worked for me (I could try this on some toy installation without taking risks). Could somebody please review the above instruction and comment if this works in general? Thankyou.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Oct 1 '14 at 21:19









                              HelpingHandHelpingHand

                              91




                              91





















                                  0














                                  This is the procedure I went with:




                                  1. Extend the logical volume of the kvm guest



                                    # lvextend -L+50G /dev/storage_pool/guest.img



                                  2. Shutdown the kvm guest and deactivate the logical volume



                                    # virsh shutdown guest
                                    # lvchange -a n /dev/storage_pool/guest.img



                                  3. List and note the partition information of the kvm guest, most importantly the first sector. If it doesn't display sectors you may need to add the '-u' or '-u sectors' switch



                                    # fdisk -l /dev/storage_pool/guest.img



                                  4. Delete and recreate the partition to fill the whole extended space, make sure you are using sectors as units and to select the same first sector (usually 2048 if partition is aligned), you can use the 'u' fdisk command to toggle between units



                                    # fdisk /dev/storage_pool/guest.img
                                    Command (m for help): d
                                    Partition number (1-4): 1
                                    Command (m for help): n
                                    Command action
                                    e extended
                                    p primary partition (1-4)
                                    p
                                    Partition number (1-4): 1
                                    First sector (...): 2048
                                    Last sector...: hit enter and use the default last sector
                                    Command (m for help): a
                                    Partition number (1-4): 1
                                    Command (m for help): w



                                  5. Expose the ext3/4 filesystem and resize it



                                    # kpartx -a -v /dev/storage_pool/guest.img
                                    # e2fsck -p -f /dev/mapper/storage_pool-guest.img1
                                    # resize2fs /dev/mapper/storage_pool-guest.img1
                                    # e2fsck -p -f /dev/mapper/storage_pool-guest.img1
                                    # kpartx -d -v /dev/storage_pool/guest.img



                                  6. Activate the logical volume and start the kvm guest



                                    # lvchange -a y /dev/storage_pool/guest.img
                                    # virsh start guest






                                  share|improve this answer



























                                    0














                                    This is the procedure I went with:




                                    1. Extend the logical volume of the kvm guest



                                      # lvextend -L+50G /dev/storage_pool/guest.img



                                    2. Shutdown the kvm guest and deactivate the logical volume



                                      # virsh shutdown guest
                                      # lvchange -a n /dev/storage_pool/guest.img



                                    3. List and note the partition information of the kvm guest, most importantly the first sector. If it doesn't display sectors you may need to add the '-u' or '-u sectors' switch



                                      # fdisk -l /dev/storage_pool/guest.img



                                    4. Delete and recreate the partition to fill the whole extended space, make sure you are using sectors as units and to select the same first sector (usually 2048 if partition is aligned), you can use the 'u' fdisk command to toggle between units



                                      # fdisk /dev/storage_pool/guest.img
                                      Command (m for help): d
                                      Partition number (1-4): 1
                                      Command (m for help): n
                                      Command action
                                      e extended
                                      p primary partition (1-4)
                                      p
                                      Partition number (1-4): 1
                                      First sector (...): 2048
                                      Last sector...: hit enter and use the default last sector
                                      Command (m for help): a
                                      Partition number (1-4): 1
                                      Command (m for help): w



                                    5. Expose the ext3/4 filesystem and resize it



                                      # kpartx -a -v /dev/storage_pool/guest.img
                                      # e2fsck -p -f /dev/mapper/storage_pool-guest.img1
                                      # resize2fs /dev/mapper/storage_pool-guest.img1
                                      # e2fsck -p -f /dev/mapper/storage_pool-guest.img1
                                      # kpartx -d -v /dev/storage_pool/guest.img



                                    6. Activate the logical volume and start the kvm guest



                                      # lvchange -a y /dev/storage_pool/guest.img
                                      # virsh start guest






                                    share|improve this answer

























                                      0












                                      0








                                      0







                                      This is the procedure I went with:




                                      1. Extend the logical volume of the kvm guest



                                        # lvextend -L+50G /dev/storage_pool/guest.img



                                      2. Shutdown the kvm guest and deactivate the logical volume



                                        # virsh shutdown guest
                                        # lvchange -a n /dev/storage_pool/guest.img



                                      3. List and note the partition information of the kvm guest, most importantly the first sector. If it doesn't display sectors you may need to add the '-u' or '-u sectors' switch



                                        # fdisk -l /dev/storage_pool/guest.img



                                      4. Delete and recreate the partition to fill the whole extended space, make sure you are using sectors as units and to select the same first sector (usually 2048 if partition is aligned), you can use the 'u' fdisk command to toggle between units



                                        # fdisk /dev/storage_pool/guest.img
                                        Command (m for help): d
                                        Partition number (1-4): 1
                                        Command (m for help): n
                                        Command action
                                        e extended
                                        p primary partition (1-4)
                                        p
                                        Partition number (1-4): 1
                                        First sector (...): 2048
                                        Last sector...: hit enter and use the default last sector
                                        Command (m for help): a
                                        Partition number (1-4): 1
                                        Command (m for help): w



                                      5. Expose the ext3/4 filesystem and resize it



                                        # kpartx -a -v /dev/storage_pool/guest.img
                                        # e2fsck -p -f /dev/mapper/storage_pool-guest.img1
                                        # resize2fs /dev/mapper/storage_pool-guest.img1
                                        # e2fsck -p -f /dev/mapper/storage_pool-guest.img1
                                        # kpartx -d -v /dev/storage_pool/guest.img



                                      6. Activate the logical volume and start the kvm guest



                                        # lvchange -a y /dev/storage_pool/guest.img
                                        # virsh start guest






                                      share|improve this answer













                                      This is the procedure I went with:




                                      1. Extend the logical volume of the kvm guest



                                        # lvextend -L+50G /dev/storage_pool/guest.img



                                      2. Shutdown the kvm guest and deactivate the logical volume



                                        # virsh shutdown guest
                                        # lvchange -a n /dev/storage_pool/guest.img



                                      3. List and note the partition information of the kvm guest, most importantly the first sector. If it doesn't display sectors you may need to add the '-u' or '-u sectors' switch



                                        # fdisk -l /dev/storage_pool/guest.img



                                      4. Delete and recreate the partition to fill the whole extended space, make sure you are using sectors as units and to select the same first sector (usually 2048 if partition is aligned), you can use the 'u' fdisk command to toggle between units



                                        # fdisk /dev/storage_pool/guest.img
                                        Command (m for help): d
                                        Partition number (1-4): 1
                                        Command (m for help): n
                                        Command action
                                        e extended
                                        p primary partition (1-4)
                                        p
                                        Partition number (1-4): 1
                                        First sector (...): 2048
                                        Last sector...: hit enter and use the default last sector
                                        Command (m for help): a
                                        Partition number (1-4): 1
                                        Command (m for help): w



                                      5. Expose the ext3/4 filesystem and resize it



                                        # kpartx -a -v /dev/storage_pool/guest.img
                                        # e2fsck -p -f /dev/mapper/storage_pool-guest.img1
                                        # resize2fs /dev/mapper/storage_pool-guest.img1
                                        # e2fsck -p -f /dev/mapper/storage_pool-guest.img1
                                        # kpartx -d -v /dev/storage_pool/guest.img



                                      6. Activate the logical volume and start the kvm guest



                                        # lvchange -a y /dev/storage_pool/guest.img
                                        # virsh start guest







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Aug 8 '15 at 14:57









                                      f10bitf10bit

                                      10615




                                      10615





















                                          0














                                          Anyone who looking for an answer for this question, need to check out this:



                                          KVM guest doesn't recognize new size of raw disk after lvresize



                                          I think virsh blockreisze is much better than fdisk or parted.






                                          share|improve this answer





























                                            0














                                            Anyone who looking for an answer for this question, need to check out this:



                                            KVM guest doesn't recognize new size of raw disk after lvresize



                                            I think virsh blockreisze is much better than fdisk or parted.






                                            share|improve this answer



























                                              0












                                              0








                                              0







                                              Anyone who looking for an answer for this question, need to check out this:



                                              KVM guest doesn't recognize new size of raw disk after lvresize



                                              I think virsh blockreisze is much better than fdisk or parted.






                                              share|improve this answer















                                              Anyone who looking for an answer for this question, need to check out this:



                                              KVM guest doesn't recognize new size of raw disk after lvresize



                                              I think virsh blockreisze is much better than fdisk or parted.







                                              share|improve this answer














                                              share|improve this answer



                                              share|improve this answer








                                              edited Apr 13 '17 at 12:14









                                              Community

                                              1




                                              1










                                              answered Apr 6 '17 at 8:25









                                              pingzpingz

                                              785




                                              785



























                                                  draft saved

                                                  draft discarded
















































                                                  Thanks for contributing an answer to Server Fault!


                                                  • Please be sure to answer the question. Provide details and share your research!

                                                  But avoid


                                                  • Asking for help, clarification, or responding to other answers.

                                                  • Making statements based on opinion; back them up with references or personal experience.

                                                  To learn more, see our tips on writing great answers.




                                                  draft saved


                                                  draft discarded














                                                  StackExchange.ready(
                                                  function ()
                                                  StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f594588%2fhow-to-increase-kvm-guest-disk-size-using-lvm-vg-as-storage-pool%23new-answer', 'question_page');

                                                  );

                                                  Post as a guest















                                                  Required, but never shown





















































                                                  Required, but never shown














                                                  Required, but never shown












                                                  Required, but never shown







                                                  Required, but never shown

































                                                  Required, but never shown














                                                  Required, but never shown












                                                  Required, but never shown







                                                  Required, but never shown







                                                  Popular posts from this blog

                                                  Club Baloncesto Breogán Índice Historia | Pavillón | Nome | O Breogán na cultura popular | Xogadores | Adestradores | Presidentes | Palmarés | Historial | Líderes | Notas | Véxase tamén | Menú de navegacióncbbreogan.galCadroGuía oficial da ACB 2009-10, páxina 201Guía oficial ACB 1992, páxina 183. Editorial DB.É de 6.500 espectadores sentados axeitándose á última normativa"Estudiantes Junior, entre as mellores canteiras"o orixinalHemeroteca El Mundo Deportivo, 16 setembro de 1970, páxina 12Historia do BreogánAlfredo Pérez, o último canoneiroHistoria C.B. BreogánHemeroteca de El Mundo DeportivoJimmy Wright, norteamericano do Breogán deixará Lugo por ameazas de morteResultados de Breogán en 1986-87Resultados de Breogán en 1990-91Ficha de Velimir Perasović en acb.comResultados de Breogán en 1994-95Breogán arrasa al Barça. "El Mundo Deportivo", 27 de setembro de 1999, páxina 58CB Breogán - FC BarcelonaA FEB invita a participar nunha nova Liga EuropeaCharlie Bell na prensa estatalMáximos anotadores 2005Tempada 2005-06 : Tódolos Xogadores da Xornada""Non quero pensar nunha man negra, mais pregúntome que está a pasar""o orixinalRaúl López, orgulloso dos xogadores, presume da boa saúde económica do BreogánJulio González confirma que cesa como presidente del BreogánHomenaxe a Lisardo GómezA tempada do rexurdimento celesteEntrevista a Lisardo GómezEl COB dinamita el Pazo para forzar el quinto (69-73)Cafés Candelas, patrocinador del CB Breogán"Suso Lázare, novo presidente do Breogán"o orixinalCafés Candelas Breogán firma el mayor triunfo de la historiaEl Breogán realizará 17 homenajes por su cincuenta aniversario"O Breogán honra ao seu fundador e primeiro presidente"o orixinalMiguel Giao recibiu a homenaxe do PazoHomenaxe aos primeiros gladiadores celestesO home que nos amosa como ver o Breo co corazónTita Franco será homenaxeada polos #50anosdeBreoJulio Vila recibirá unha homenaxe in memoriam polos #50anosdeBreo"O Breogán homenaxeará aos seus aboados máis veteráns"Pechada ovación a «Capi» Sanmartín e Ricardo «Corazón de González»Homenaxe por décadas de informaciónPaco García volve ao Pazo con motivo do 50 aniversario"Resultados y clasificaciones""O Cafés Candelas Breogán, campión da Copa Princesa""O Cafés Candelas Breogán, equipo ACB"C.B. Breogán"Proxecto social"o orixinal"Centros asociados"o orixinalFicha en imdb.comMario Camus trata la recuperación del amor en 'La vieja música', su última película"Páxina web oficial""Club Baloncesto Breogán""C. B. Breogán S.A.D."eehttp://www.fegaba.com

                                                  Vilaño, A Laracha Índice Patrimonio | Lugares e parroquias | Véxase tamén | Menú de navegación43°14′52″N 8°36′03″O / 43.24775, -8.60070

                                                  Cegueira Índice Epidemioloxía | Deficiencia visual | Tipos de cegueira | Principais causas de cegueira | Tratamento | Técnicas de adaptación e axudas | Vida dos cegos | Primeiros auxilios | Crenzas respecto das persoas cegas | Crenzas das persoas cegas | O neno deficiente visual | Aspectos psicolóxicos da cegueira | Notas | Véxase tamén | Menú de navegación54.054.154.436928256blindnessDicionario da Real Academia GalegaPortal das Palabras"International Standards: Visual Standards — Aspects and Ranges of Vision Loss with Emphasis on Population Surveys.""Visual impairment and blindness""Presentan un plan para previr a cegueira"o orixinalACCDV Associació Catalana de Cecs i Disminuïts Visuals - PMFTrachoma"Effect of gene therapy on visual function in Leber's congenital amaurosis"1844137110.1056/NEJMoa0802268Cans guía - os mellores amigos dos cegosArquivadoEscola de cans guía para cegos en Mortágua, PortugalArquivado"Tecnología para ciegos y deficientes visuales. Recopilación de recursos gratuitos en la Red""Colorino""‘COL.diesis’, escuchar los sonidos del color""COL.diesis: Transforming Colour into Melody and Implementing the Result in a Colour Sensor Device"o orixinal"Sistema de desarrollo de sinestesia color-sonido para invidentes utilizando un protocolo de audio""Enseñanza táctil - geometría y color. Juegos didácticos para niños ciegos y videntes""Sistema Constanz"L'ocupació laboral dels cecs a l'Estat espanyol està pràcticament equiparada a la de les persones amb visió, entrevista amb Pedro ZuritaONCE (Organización Nacional de Cegos de España)Prevención da cegueiraDescrición de deficiencias visuais (Disc@pnet)Braillín, un boneco atractivo para calquera neno, con ou sen discapacidade, que permite familiarizarse co sistema de escritura e lectura brailleAxudas Técnicas36838ID00897494007150-90057129528256DOID:1432HP:0000618D001766C10.597.751.941.162C97109C0155020