{"id":169,"date":"2009-12-09T21:26:44","date_gmt":"2009-12-10T03:26:44","guid":{"rendered":"http:\/\/www.ecimulti.org\/blog\/?p=169"},"modified":"2012-11-23T13:44:02","modified_gmt":"2012-11-23T19:44:02","slug":"esx-linux-lvm-file-system-expansion-and-you","status":"publish","type":"post","link":"https:\/\/www.ecimulti.org\/blog\/?p=169","title":{"rendered":"ESX, Linux LVM, file system expansion and you."},"content":{"rendered":"<p>I see quite a few methods being used out there for logicial volume expansion. Everything from what I&#8217;m about to post all the way down to folks using cloning tools like Ghost and Clonezilla. Heres how I do it, and it works good for me. Note that I typically do these offline, for no other reason than I&#8217;ve biffed enough servers in my life to not be in a rush. If you&#8217;re needing 5-9&#8217;s uptime, look for another blog. It seems more than anything I have to expand \/ and so that also can play into this.<\/p>\n<p>Likely a good idea to visit the LVM man pages and\/or this site if your LVM is a bit weak: <a href=\"http:\/\/sourceware.org\/lvm2\/\">read this<\/a>\u00a0and <a href=\"http:\/\/sunoano.name\/ws\/public_xhtml\/lvm.html\">maybe also this.<\/a><\/p>\n<ol>\n<li>Shutdown the VM.<\/li>\n<li>Extend the VMDK you&#8217;re working with. You have a couple choices here. You can either extend it from the service console like so: vmkfstools -X 5G \/path\/to\/the\/vmdk (would add 5GB to that VMDK)\u00a0or you can also extend it in the Virtual Infrastructure Client. If you use the service console, look at the options for vmkfstools for the exact syntax for your case.<\/li>\n<li>I think it goes without saying you should have backups and\/or snapshots of the VM.<\/li>\n<li>Boot the LiveCD for your particular flavor of Linux. There are LVM LiveCD&#8217;s out there too, and also I bet a Knoppix disc\u00a0might even work if in a pinch. I happen to run SLES &amp; openSUSE pretty much exclusivly and the LiveCD&#8217;s work pretty well.<\/li>\n<li>Use fdisk and partition your new found space properly. Make sure you change the type to LVM\u00a0(8e).\u00a0If you&#8217;re not savvy with fdisk, you should likely stop now.<\/li>\n<li>So lets say the new partition you created is \/dev\/sda5. You now need to create a new physical volume, use the command:<strong> pvcreate \/dev\/sda5<\/strong> and with any luck it&#8217;ll complete.<\/li>\n<li>Now you need to extend the volume group to the physical volume you just added. Use the command:<strong> vgextend *volumenamehere* \/dev\/sda5<\/strong>. Use vgdisplay if you don&#8217;t know which volume group you need to extend off the top of your head.<\/li>\n<li>Finally, its time to extend the logical volume itself. Use this command: <strong>lvextend -L 5GB \/your\/logical\/volume\/here<\/strong>. Use lvdisplay if you don&#8217;t know which LV you want to extend by heart. In this example I added 5GB to the volume. If you wanted to consume all space on the VG, you&#8217;d use something like this: <strong>lvextend -l +100%FREE \/your\/logical\/volume\/here<\/strong><\/li>\n<li>At this point, if everything worked, you can expand the file system. On the systems I administrate we typically use XFS these days. XFS requires the filesystem to be online to grow. So while in the LiveCD you can quickly mount say \/dev\/system\/root to \/mnt and then execute <strong>xfs_growfs \/mnt<\/strong>. Research the proper way to grow whatever file system YOU\u00a0happen to use.<\/li>\n<li>Reboot the VM and make sure all is well.<\/li>\n<\/ol>\n<p>Till\u00a0next time&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I see quite a few methods being used out there for logicial volume expansion. Everything from what I&#8217;m about to post all the way down to folks using cloning tools like Ghost and Clonezilla. Heres how I do it, and it works good for me. Note that I typically do these offline, for no other [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,17],"tags":[112,110,22,23,20],"class_list":["post-169","post","type-post","status-publish","format-standard","hentry","category-linux","category-san","tag-vmware-esx-esxi","tag-linux","tag-lvm","tag-opensuse","tag-sles"],"_links":{"self":[{"href":"https:\/\/www.ecimulti.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/169","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ecimulti.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ecimulti.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ecimulti.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ecimulti.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=169"}],"version-history":[{"count":13,"href":"https:\/\/www.ecimulti.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/169\/revisions"}],"predecessor-version":[{"id":362,"href":"https:\/\/www.ecimulti.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/169\/revisions\/362"}],"wp:attachment":[{"href":"https:\/\/www.ecimulti.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ecimulti.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ecimulti.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}