{"id":157,"date":"2024-02-26T11:02:50","date_gmt":"2024-02-26T19:02:50","guid":{"rendered":"https:\/\/www.liljegrens.org\/?p=157"},"modified":"2024-02-26T11:02:51","modified_gmt":"2024-02-26T19:02:51","slug":"expand-linux-vm","status":"publish","type":"post","link":"https:\/\/www.liljegrens.org\/?p=157","title":{"rendered":"Expand Linux VM"},"content":{"rendered":"\n<p>In the event a VM requires more space we can expand the allotment of storage.  First thing to check is the amount of free space available to the VM.  40G was provisioned in ESXi but Ubuntu shows 19G allotted and 7.2 used.  It is common a VM isn&#8217;t reflecting the allotted space at creation.   The next two images show that situation.  In the case where expansion is needed at the virtual host level, increase the provision in ESXi prior to continuing.  Make sure to have a good backup of the VM with no snapshots.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"788\" height=\"259\" src=\"https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-09-58-33.png\" alt=\"\" class=\"wp-image-158\" srcset=\"https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-09-58-33.png 788w, https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-09-58-33-300x99.png 300w, https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-09-58-33-768x252.png 768w\" sizes=\"(max-width: 788px) 100vw, 788px\" \/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>df -h<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"777\" height=\"201\" src=\"https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-08-55-39.png\" alt=\"\" class=\"wp-image-159\" srcset=\"https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-08-55-39.png 777w, https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-08-55-39-300x78.png 300w, https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-08-55-39-768x199.png 768w\" sizes=\"(max-width: 777px) 100vw, 777px\" \/><\/figure>\n\n\n\n<p>vgdisplay can show the space Ubuntu has available that is &#8220;free&#8221;.  Observe VG Size, Alloc PE and Free PE \/ Size in the below image.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo vgdisplay<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"726\" height=\"467\" src=\"https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-10-04-02.png\" alt=\"\" class=\"wp-image-160\" srcset=\"https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-10-04-02.png 726w, https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-10-04-02-300x193.png 300w\" sizes=\"(max-width: 726px) 100vw, 726px\" \/><\/figure>\n\n\n\n<p>Utilize lvextend to expand into the unused space.  Note the LV Path from the output of lvdisplay.  In this case it&#8217;s \/dev\/ubuntu-vg\/ubuntu-lv<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo lvextend -l +100%FREE \/dev\/ubuntu-vg\/ubuntu-lv<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"877\" height=\"122\" src=\"https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-10-43-49.png\" alt=\"\" class=\"wp-image-164\" srcset=\"https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-10-43-49.png 877w, https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-10-43-49-300x42.png 300w, https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-10-43-49-768x107.png 768w\" sizes=\"(max-width: 877px) 100vw, 877px\" \/><\/figure>\n\n\n\n<p>resize2fs will perform the last step.  Note the path from df -h<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo resize2fs \/dev\/mapper\/ubuntu--vg-ubuntu--lv<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"880\" height=\"190\" src=\"https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-10-45-28.png\" alt=\"\" class=\"wp-image-165\" srcset=\"https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-10-45-28.png 880w, https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-10-45-28-300x65.png 300w, https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-10-45-28-768x166.png 768w\" sizes=\"(max-width: 880px) 100vw, 880px\" \/><\/figure>\n\n\n\n<p>The output from vgdisplay and lvdisplay will confirm the expansion.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo vgdisplay<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"831\" height=\"465\" src=\"https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-10-49-25.png\" alt=\"\" class=\"wp-image-166\" srcset=\"https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-10-49-25.png 831w, https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-10-49-25-300x168.png 300w, https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-10-49-25-768x430.png 768w\" sizes=\"(max-width: 831px) 100vw, 831px\" \/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo lvdisplay<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"820\" height=\"394\" src=\"https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-10-50-28.png\" alt=\"\" class=\"wp-image-167\" srcset=\"https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-10-50-28.png 820w, https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-10-50-28-300x144.png 300w, https:\/\/www.liljegrens.org\/wp-content\/uploads\/2024\/02\/Screenshot-from-2024-02-26-10-50-28-768x369.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/figure>\n\n\n\n<p> <\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the event a VM requires more space we can expand the allotment of storage. First thing to check is<\/p>\n<p><a href=\"https:\/\/www.liljegrens.org\/?p=157\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\">Expand Linux VM<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/www.liljegrens.org\/index.php?rest_route=\/wp\/v2\/posts\/157"}],"collection":[{"href":"https:\/\/www.liljegrens.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.liljegrens.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.liljegrens.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.liljegrens.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=157"}],"version-history":[{"count":1,"href":"https:\/\/www.liljegrens.org\/index.php?rest_route=\/wp\/v2\/posts\/157\/revisions"}],"predecessor-version":[{"id":168,"href":"https:\/\/www.liljegrens.org\/index.php?rest_route=\/wp\/v2\/posts\/157\/revisions\/168"}],"wp:attachment":[{"href":"https:\/\/www.liljegrens.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=157"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.liljegrens.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=157"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.liljegrens.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=157"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}