KVM host, add LV to guestMoving /usr to its own filesystem/logical volumeWhat steps can I use to recover a...

How hard is it to sell a home which is currently mortgaged?

Could human civilization live 150 years in a nuclear-powered aircraft carrier colony without resorting to mass killing/ cannibalism?

Is it allowed to spend a night in the first entry country before moving to the main destination?

When are digital copies of Switch games made available to play?

Why transcripts instead of degree certificates?

Should I report a leak of confidential HR information?

How would an order of Monks that renounce their names communicate effectively?

Why do the keys in the circle of fifths have the pattern of accidentals that they do?

In the context of a differentiator circuit, what is a “current-sensing resistor”?

Meaning of もてり and use of が

Are there any features that help with the roll to avoid the destruction of a Wand of Fireballs when using the last charge?

I hit a pipe with a mower and now it won't turn

Symbol for "not absolutely continuous" in Latex

Could a Weapon of Mass Destruction, targeting only humans, be developed?

Questions about authorship rank and academic politics

Can I travel from Germany to England alone as an unaccompanied minor?

How can I reduce the sound of rain on a range hood vent?

Procedurally generate regions on island

Is there reliable evidence that depleted uranium from the 1999 NATO bombing is causing cancer in Serbia?

Is there a way for presidents to legally extend their terms beyond the maximum of four years?

Does Anosov geodesic flow imply asphericity?

Why won't the ground take my seed?

Needle Hotend for nonplanar printing

Why isn’t the tax system continuous rather than bracketed?



KVM host, add LV to guest


Moving /usr to its own filesystem/logical volumeWhat steps can I use to recover a RAID 1 array with LVM and EXT3 on it?Software RAID 10 + LVM on mixed drives, sector alignment?KVM linux guest, 2nd HDD, LVM partition or whole diskLVM: is this mirrored? is copy this slow?Ubuntu 14.04 software RAID with LVM install won't boot on bare metalWindows overrode a LVM pv metadataHow to add a btrfs raid 1 to an encrypted lvm2 volume group under Solus OS (Linux)?Resize2fs keeps asking me to run e2fsck -fExtending a multipath'd /dev/mapper device that isn't listed as an LVM anywhere






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















I have a KVM host with a software RAID 10 array. The software RAID 10 array is a PV on the host and there's a single VG.



I have a couple of LVs used at the host level (a datastore for KVM guest .img files).



Normally when adding a new disk to a guest I create the LV on the host then add that to the guest's config. Then pvcreate directly on the block device (no partition), vgcreate, lvcreate and mkfs on the new block device within the guest.



I don't bother partitioning the block device before pvcreate because it's one less step to do when resizing the LV on the host. I realise the downside is in theory some systems might decide to automatically partition the unpartitioned block device because they don't recognise the LVM metadata, though I have never ever seen this happen in practice.



When resizing the LV on the host the free space in the PV is picked up and I have to vgextend, lvextend and resize2fs in the guest.

I don't suppose there's a way I can skip having LVM running in the guest and just lvextend on the host then resize2fs in the guest?










share|improve this question





























    1















    I have a KVM host with a software RAID 10 array. The software RAID 10 array is a PV on the host and there's a single VG.



    I have a couple of LVs used at the host level (a datastore for KVM guest .img files).



    Normally when adding a new disk to a guest I create the LV on the host then add that to the guest's config. Then pvcreate directly on the block device (no partition), vgcreate, lvcreate and mkfs on the new block device within the guest.



    I don't bother partitioning the block device before pvcreate because it's one less step to do when resizing the LV on the host. I realise the downside is in theory some systems might decide to automatically partition the unpartitioned block device because they don't recognise the LVM metadata, though I have never ever seen this happen in practice.



    When resizing the LV on the host the free space in the PV is picked up and I have to vgextend, lvextend and resize2fs in the guest.

    I don't suppose there's a way I can skip having LVM running in the guest and just lvextend on the host then resize2fs in the guest?










    share|improve this question

























      1












      1








      1


      1






      I have a KVM host with a software RAID 10 array. The software RAID 10 array is a PV on the host and there's a single VG.



      I have a couple of LVs used at the host level (a datastore for KVM guest .img files).



      Normally when adding a new disk to a guest I create the LV on the host then add that to the guest's config. Then pvcreate directly on the block device (no partition), vgcreate, lvcreate and mkfs on the new block device within the guest.



      I don't bother partitioning the block device before pvcreate because it's one less step to do when resizing the LV on the host. I realise the downside is in theory some systems might decide to automatically partition the unpartitioned block device because they don't recognise the LVM metadata, though I have never ever seen this happen in practice.



      When resizing the LV on the host the free space in the PV is picked up and I have to vgextend, lvextend and resize2fs in the guest.

      I don't suppose there's a way I can skip having LVM running in the guest and just lvextend on the host then resize2fs in the guest?










      share|improve this question














      I have a KVM host with a software RAID 10 array. The software RAID 10 array is a PV on the host and there's a single VG.



      I have a couple of LVs used at the host level (a datastore for KVM guest .img files).



      Normally when adding a new disk to a guest I create the LV on the host then add that to the guest's config. Then pvcreate directly on the block device (no partition), vgcreate, lvcreate and mkfs on the new block device within the guest.



      I don't bother partitioning the block device before pvcreate because it's one less step to do when resizing the LV on the host. I realise the downside is in theory some systems might decide to automatically partition the unpartitioned block device because they don't recognise the LVM metadata, though I have never ever seen this happen in practice.



      When resizing the LV on the host the free space in the PV is picked up and I have to vgextend, lvextend and resize2fs in the guest.

      I don't suppose there's a way I can skip having LVM running in the guest and just lvextend on the host then resize2fs in the guest?







      lvm kvm






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 6 '15 at 15:34









      batfastadbatfastad

      7952 gold badges10 silver badges21 bronze badges




      7952 gold badges10 silver badges21 bronze badges






















          2 Answers
          2






          active

          oldest

          votes


















          2















          I don't suppose there's a way I can skip having LVM running in the guest and just lvextend on the host then resize2fs in the guest?




          There's absolutely no requirement to use LVM inside a guest. You can just use the block device directly. Using LVM inside the guest gets you almost nothing (since you're already using LVM on the host to manage your space).



          If by "KVM" you mean "libvirt", you can do use the virsh blockresize command to get your guest to recognize the additional space once you've resized a block device. That is, if I have a guest with an attached LV:



          </disk><disk type="block" device="disk">
          <driver name="qemu" type="raw"/>
          <source dev="/dev/tank/foobar"/>
          <backingStore/>
          <target dev="vdb" bus="virtio"/>
          <alias name="virtio-disk1"/></disk>


          Where:



          # lvs
          foobar tank -wi-ao---- 4.00g


          I can add space to the LV on the host:



          # lvresize -L +2G /dev/tank/foobar


          Tell libvirt to update the size:



          # virsh blockresize myguest /dev/tank/foobar --size 0


          And then inside the guest, resize the filestem:



          guest# resize2fs 1.42.12 (29-Aug-2014)
          Resizing the filesystem on /dev/vdb to 1572864 (4k) blocks.
          The filesystem on /dev/vdb is now 1572864 (4k) blocks long.





          share|improve this answer
























          • That's ideal. I thought it was totally pointless having LVM in the guest but wasn't sure if I could write an FS directly to the block device within the guest. Thanks!

            – batfastad
            Aug 7 '15 at 23:30



















          0














          I've a similar issue. But I can not use blockresize because I'm using an old virsh version under RHEL 5 (I know I should upgrade but it has dependencies with application) I extended the LVM in the host but what should be the process to "notify" the guest the LVM has a new size?






          share|improve this answer








          New contributor



          Pedro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.






















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "106"
            };
            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: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            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%2funix.stackexchange.com%2fquestions%2f220583%2fkvm-host-add-lv-to-guest%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2















            I don't suppose there's a way I can skip having LVM running in the guest and just lvextend on the host then resize2fs in the guest?




            There's absolutely no requirement to use LVM inside a guest. You can just use the block device directly. Using LVM inside the guest gets you almost nothing (since you're already using LVM on the host to manage your space).



            If by "KVM" you mean "libvirt", you can do use the virsh blockresize command to get your guest to recognize the additional space once you've resized a block device. That is, if I have a guest with an attached LV:



            </disk><disk type="block" device="disk">
            <driver name="qemu" type="raw"/>
            <source dev="/dev/tank/foobar"/>
            <backingStore/>
            <target dev="vdb" bus="virtio"/>
            <alias name="virtio-disk1"/></disk>


            Where:



            # lvs
            foobar tank -wi-ao---- 4.00g


            I can add space to the LV on the host:



            # lvresize -L +2G /dev/tank/foobar


            Tell libvirt to update the size:



            # virsh blockresize myguest /dev/tank/foobar --size 0


            And then inside the guest, resize the filestem:



            guest# resize2fs 1.42.12 (29-Aug-2014)
            Resizing the filesystem on /dev/vdb to 1572864 (4k) blocks.
            The filesystem on /dev/vdb is now 1572864 (4k) blocks long.





            share|improve this answer
























            • That's ideal. I thought it was totally pointless having LVM in the guest but wasn't sure if I could write an FS directly to the block device within the guest. Thanks!

              – batfastad
              Aug 7 '15 at 23:30
















            2















            I don't suppose there's a way I can skip having LVM running in the guest and just lvextend on the host then resize2fs in the guest?




            There's absolutely no requirement to use LVM inside a guest. You can just use the block device directly. Using LVM inside the guest gets you almost nothing (since you're already using LVM on the host to manage your space).



            If by "KVM" you mean "libvirt", you can do use the virsh blockresize command to get your guest to recognize the additional space once you've resized a block device. That is, if I have a guest with an attached LV:



            </disk><disk type="block" device="disk">
            <driver name="qemu" type="raw"/>
            <source dev="/dev/tank/foobar"/>
            <backingStore/>
            <target dev="vdb" bus="virtio"/>
            <alias name="virtio-disk1"/></disk>


            Where:



            # lvs
            foobar tank -wi-ao---- 4.00g


            I can add space to the LV on the host:



            # lvresize -L +2G /dev/tank/foobar


            Tell libvirt to update the size:



            # virsh blockresize myguest /dev/tank/foobar --size 0


            And then inside the guest, resize the filestem:



            guest# resize2fs 1.42.12 (29-Aug-2014)
            Resizing the filesystem on /dev/vdb to 1572864 (4k) blocks.
            The filesystem on /dev/vdb is now 1572864 (4k) blocks long.





            share|improve this answer
























            • That's ideal. I thought it was totally pointless having LVM in the guest but wasn't sure if I could write an FS directly to the block device within the guest. Thanks!

              – batfastad
              Aug 7 '15 at 23:30














            2












            2








            2








            I don't suppose there's a way I can skip having LVM running in the guest and just lvextend on the host then resize2fs in the guest?




            There's absolutely no requirement to use LVM inside a guest. You can just use the block device directly. Using LVM inside the guest gets you almost nothing (since you're already using LVM on the host to manage your space).



            If by "KVM" you mean "libvirt", you can do use the virsh blockresize command to get your guest to recognize the additional space once you've resized a block device. That is, if I have a guest with an attached LV:



            </disk><disk type="block" device="disk">
            <driver name="qemu" type="raw"/>
            <source dev="/dev/tank/foobar"/>
            <backingStore/>
            <target dev="vdb" bus="virtio"/>
            <alias name="virtio-disk1"/></disk>


            Where:



            # lvs
            foobar tank -wi-ao---- 4.00g


            I can add space to the LV on the host:



            # lvresize -L +2G /dev/tank/foobar


            Tell libvirt to update the size:



            # virsh blockresize myguest /dev/tank/foobar --size 0


            And then inside the guest, resize the filestem:



            guest# resize2fs 1.42.12 (29-Aug-2014)
            Resizing the filesystem on /dev/vdb to 1572864 (4k) blocks.
            The filesystem on /dev/vdb is now 1572864 (4k) blocks long.





            share|improve this answer














            I don't suppose there's a way I can skip having LVM running in the guest and just lvextend on the host then resize2fs in the guest?




            There's absolutely no requirement to use LVM inside a guest. You can just use the block device directly. Using LVM inside the guest gets you almost nothing (since you're already using LVM on the host to manage your space).



            If by "KVM" you mean "libvirt", you can do use the virsh blockresize command to get your guest to recognize the additional space once you've resized a block device. That is, if I have a guest with an attached LV:



            </disk><disk type="block" device="disk">
            <driver name="qemu" type="raw"/>
            <source dev="/dev/tank/foobar"/>
            <backingStore/>
            <target dev="vdb" bus="virtio"/>
            <alias name="virtio-disk1"/></disk>


            Where:



            # lvs
            foobar tank -wi-ao---- 4.00g


            I can add space to the LV on the host:



            # lvresize -L +2G /dev/tank/foobar


            Tell libvirt to update the size:



            # virsh blockresize myguest /dev/tank/foobar --size 0


            And then inside the guest, resize the filestem:



            guest# resize2fs 1.42.12 (29-Aug-2014)
            Resizing the filesystem on /dev/vdb to 1572864 (4k) blocks.
            The filesystem on /dev/vdb is now 1572864 (4k) blocks long.






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Aug 6 '15 at 20:49









            larskslarsks

            12.2k3 gold badges30 silver badges42 bronze badges




            12.2k3 gold badges30 silver badges42 bronze badges













            • That's ideal. I thought it was totally pointless having LVM in the guest but wasn't sure if I could write an FS directly to the block device within the guest. Thanks!

              – batfastad
              Aug 7 '15 at 23:30



















            • That's ideal. I thought it was totally pointless having LVM in the guest but wasn't sure if I could write an FS directly to the block device within the guest. Thanks!

              – batfastad
              Aug 7 '15 at 23:30

















            That's ideal. I thought it was totally pointless having LVM in the guest but wasn't sure if I could write an FS directly to the block device within the guest. Thanks!

            – batfastad
            Aug 7 '15 at 23:30





            That's ideal. I thought it was totally pointless having LVM in the guest but wasn't sure if I could write an FS directly to the block device within the guest. Thanks!

            – batfastad
            Aug 7 '15 at 23:30













            0














            I've a similar issue. But I can not use blockresize because I'm using an old virsh version under RHEL 5 (I know I should upgrade but it has dependencies with application) I extended the LVM in the host but what should be the process to "notify" the guest the LVM has a new size?






            share|improve this answer








            New contributor



            Pedro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.
























              0














              I've a similar issue. But I can not use blockresize because I'm using an old virsh version under RHEL 5 (I know I should upgrade but it has dependencies with application) I extended the LVM in the host but what should be the process to "notify" the guest the LVM has a new size?






              share|improve this answer








              New contributor



              Pedro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.






















                0












                0








                0







                I've a similar issue. But I can not use blockresize because I'm using an old virsh version under RHEL 5 (I know I should upgrade but it has dependencies with application) I extended the LVM in the host but what should be the process to "notify" the guest the LVM has a new size?






                share|improve this answer








                New contributor



                Pedro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                I've a similar issue. But I can not use blockresize because I'm using an old virsh version under RHEL 5 (I know I should upgrade but it has dependencies with application) I extended the LVM in the host but what should be the process to "notify" the guest the LVM has a new size?







                share|improve this answer








                New contributor



                Pedro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.








                share|improve this answer



                share|improve this answer






                New contributor



                Pedro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.








                answered 1 hour ago









                PedroPedro

                1




                1




                New contributor



                Pedro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.




                New contributor




                Pedro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • 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%2funix.stackexchange.com%2fquestions%2f220583%2fkvm-host-add-lv-to-guest%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

                    Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

                    Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

                    Ciclooctatetraenă Vezi și | Bibliografie | Meniu de navigare637866text4148569-500570979m