{"id":283,"date":"2024-07-09T12:49:03","date_gmt":"2024-07-09T19:49:03","guid":{"rendered":"https:\/\/www.lucaswilliams.net\/?p=283"},"modified":"2024-07-09T12:58:28","modified_gmt":"2024-07-09T19:58:28","slug":"growing-ubuntu-lvm-after-install","status":"publish","type":"post","link":"https:\/\/www.lucaswilliams.net\/index.php\/2024\/07\/09\/growing-ubuntu-lvm-after-install\/","title":{"rendered":"Growing Ubuntu LVM After Install"},"content":{"rendered":"\n<p>Hello everyone. I hope you have all been well. <\/p>\n\n\n\n<p>I have a new blog entry on something I just noticed today. <\/p>\n\n\n\n<p>So I typically don&#8217;t use LVM in my Linux Virtual Machines, mainly because I have had some issues in the past trying to migrate VM&#8217;s from one hypervisor type to another, for example, VMware to KVM or vice versa. I have found that if I use LVM, I have mapping issues and it takes some work to get the VM&#8217;s working again after converting the raw disk image from vmdk to qcow2 or vice versa. <\/p>\n\n\n\n<p>However, since I don&#8217;t plan on doing that anymore (I&#8217;m sticking with KVM\/Qemu for the time being) I have looked at using LVM again since I like how easy it is to grow the volume if I have to in the future. While growing a disk image is fairly easy, trying to grow a \/dev\/vda or \/dev\/sda is a little cumbersome, usually requiring me to boot my VM with a tool like PMagic or even the Ubuntu install media and using gparted to manipulate the size and then rebooting back into the VM after successfully growing it.<\/p>\n\n\n\n<p>With LVM, this is much simpler. 3 commands and I&#8217;m done, and don&#8217;t need a reboot. Those commands:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>pvdisplay<\/code><\/li>\n\n\n\n<li><code>lvextend<\/code><\/li>\n\n\n\n<li><code>resize2fs<\/code><\/li>\n<\/ul>\n\n\n\n<p>Now, One thing I have noticed after a fresh install of Ubuntu Server 22.04.2, using LVM, I don&#8217;t get all my hard drive partition used. I noticed this after I installed, I ran <code>df -h<\/code> and noticed that my \/ folder was at 32%. I built the VM with a 50G hard drive, yet df was only seeing 23GB. I then ran <\/p>\n\n\n\n<p><code>sudo pvdisplay <\/code><\/p>\n\n\n\n<p>Sure enough, the device was 46GB in size. I then ran <\/p>\n\n\n\n<p><code>sudo lvextend -l +100%FREE \/dev\/mapper\/ubuntu--vg-ubuntu--lv<\/code> <\/p>\n\n\n\n<p>This command extended my partition out to the remaining space. Next, I grew the file system to use the new space:<\/p>\n\n\n\n<p><code>sudo resize2fs \/dev\/mapper\/ubuntu--vg-ubuntu--lv<\/code> <\/p>\n\n\n\n<p>I then ran <code>df -h<\/code> again, and low and behold, my \/ folder is now saying 46GB and 16% used instead of 32%.<\/p>\n\n\n\n<p>I hope this helps anyone else!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello everyone. I hope you have all been well. I have a new blog entry on something I just noticed today. So I typically don&rsquo;t use LVM in my Linux Virtual Machines, mainly because I have had some issues in the past trying to migrate VM&rsquo;s from one hypervisor type to another, for example, VMware [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37,49,6],"tags":[120,27,55,50,125,22,5,51],"class_list":["post-283","post","type-post","status-publish","format-standard","hentry","category-howto","category-kvm","category-ubuntu","tag-22-04","tag-canonical","tag-howto","tag-kvm","tag-lvm","tag-setup","tag-ubuntu","tag-vmware"],"_links":{"self":[{"href":"https:\/\/www.lucaswilliams.net\/index.php\/wp-json\/wp\/v2\/posts\/283","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lucaswilliams.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lucaswilliams.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lucaswilliams.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lucaswilliams.net\/index.php\/wp-json\/wp\/v2\/comments?post=283"}],"version-history":[{"count":4,"href":"https:\/\/www.lucaswilliams.net\/index.php\/wp-json\/wp\/v2\/posts\/283\/revisions"}],"predecessor-version":[{"id":288,"href":"https:\/\/www.lucaswilliams.net\/index.php\/wp-json\/wp\/v2\/posts\/283\/revisions\/288"}],"wp:attachment":[{"href":"https:\/\/www.lucaswilliams.net\/index.php\/wp-json\/wp\/v2\/media?parent=283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lucaswilliams.net\/index.php\/wp-json\/wp\/v2\/categories?post=283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lucaswilliams.net\/index.php\/wp-json\/wp\/v2\/tags?post=283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}