{"id":727,"date":"2020-12-23T07:17:05","date_gmt":"2020-12-23T06:17:05","guid":{"rendered":"https:\/\/tollana.d-tor.org\/notes-to-self\/?p=727"},"modified":"2020-12-23T07:17:05","modified_gmt":"2020-12-23T06:17:05","slug":"online-resizing-of-kvm-drive","status":"publish","type":"post","link":"https:\/\/tollana.d-tor.org\/notes-to-self\/?p=727","title":{"rendered":"Online Resizing of KVM drive"},"content":{"rendered":"\n<p>Don&#8217;t try to resize a disk of a running VM with qemu-img directly. Use virsh instead. NB: This can&#8217;t be done via the GUI, either. You have to use the shell.<\/p>\n\n\n\n<p>Gather info:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">virsh # domblkinfo &lt;domain> --all --human<\/pre>\n\n\n\n<p>Resize virtual disk:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">virsh # blockresize &lt;domain> --path &lt;vd?> --size 300GB<\/pre>\n\n\n\n<p>Then inside the VM, assuming you&#8217;re using LVM and XFS as filesystem, re-read the partition table of the resized disk, then resize the physical volume, then the logical volume and finally the filesystem:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># blockdev --rereadpt \/dev\/vd?\n# pvresize \/dev\/vd?\n# lvextend -l +&lt;no. of extends> \/dev\/mapper\/&lt;lv-name>\n# xfs_growfs \/dev\/mapper\/&lt;lv-name><\/pre>\n\n\n\n<p>That&#8217;s all, folks!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Don&#8217;t try to resize a disk of a running VM with qemu-img directly. Use virsh instead. NB: This can&#8217;t be done via the GUI, either. You have to use the shell. Gather info: virsh # domblkinfo &lt;domain> &#8211;all &#8211;human Resize virtual disk: virsh # blockresize &lt;domain> &#8211;path &lt;vd?> &#8211;size 300GB Then inside the VM, assuming &hellip; <a href=\"https:\/\/tollana.d-tor.org\/notes-to-self\/?p=727\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Online Resizing of KVM drive<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36,77],"tags":[181,179,180],"class_list":["post-727","post","type-post","status-publish","format-standard","hentry","category-hetzner","category-linux","tag-blockdev","tag-resize-disk","tag-virsh"],"_links":{"self":[{"href":"https:\/\/tollana.d-tor.org\/notes-to-self\/index.php?rest_route=\/wp\/v2\/posts\/727","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tollana.d-tor.org\/notes-to-self\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tollana.d-tor.org\/notes-to-self\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tollana.d-tor.org\/notes-to-self\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tollana.d-tor.org\/notes-to-self\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=727"}],"version-history":[{"count":1,"href":"https:\/\/tollana.d-tor.org\/notes-to-self\/index.php?rest_route=\/wp\/v2\/posts\/727\/revisions"}],"predecessor-version":[{"id":728,"href":"https:\/\/tollana.d-tor.org\/notes-to-self\/index.php?rest_route=\/wp\/v2\/posts\/727\/revisions\/728"}],"wp:attachment":[{"href":"https:\/\/tollana.d-tor.org\/notes-to-self\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=727"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tollana.d-tor.org\/notes-to-self\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=727"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tollana.d-tor.org\/notes-to-self\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}