{"id":324,"date":"2014-06-11T14:59:07","date_gmt":"2014-06-11T21:59:07","guid":{"rendered":"http:\/\/www.ossintegrators.com\/blog\/?p=324"},"modified":"2014-06-11T15:06:33","modified_gmt":"2014-06-11T22:06:33","slug":"adding-additional-disk-space-to-an-esxi-boot-partition","status":"publish","type":"post","link":"http:\/\/www.ossintegrators.com\/blog\/adding-additional-disk-space-to-an-esxi-boot-partition\/","title":{"rendered":"Adding Additional Disk Space to an ESXi Boot Partition"},"content":{"rendered":"<div style=\"padding-bottom:20px; padding-top:10px;\" class=\"hupso-share-buttons\"><!-- Hupso Share Buttons - http:\/\/www.hupso.com\/share\/ --><a class=\"hupso_toolbar\" href=\"http:\/\/www.hupso.com\/share\/\"><img decoding=\"async\" src=\"http:\/\/static.hupso.com\/share\/buttons\/share-small.png\" border=\"0\" style=\"padding-top:5px; float:left;\" alt=\"Share\"\/><\/a><script type=\"text\/javascript\">var hupso_services_t=new Array(\"Twitter\",\"Facebook\",\"Google Plus\",\"Linkedin\",\"Digg\",\"Reddit\");var hupso_toolbar_size_t=\"small\";var hupso_counters_lang = \"en_US\";var hupso_url_t=\"\";var hupso_title_t=\"Adding Additional Disk Space to an ESXi Boot Partition\";<\/script><script type=\"text\/javascript\" src=\"http:\/\/static.hupso.com\/share\/js\/share_toolbar.js\"><\/script><!-- Hupso Share Buttons --><\/div><p>This post aims to solve the most common issue that I&#8217;ve faced with our (admittedly not too large) ESXi infrastructure \u2013 how to add more drive space to a CentOS VM that only has one virtual HD. Strangely enough, this is more obtuse than it really should be!<\/p>\n<p>Note: this would be normally be completely unnecessary <strong><em>if<\/em><\/strong> you allocate enough space when creating the VM, but sometimes that&#8217;s just not an option.<\/p>\n<p><span style=\"background-color: yellow;\">Warning: you cannot expand the disk of a VM with snapshots!<\/span><\/p>\n<p>In general, you have two options for adding drive space:<\/p>\n<ol>\n<li>Make the existing VM HD larger.<\/li>\n<li>Add another VM HD.<\/li>\n<\/ol>\n<p>I&#8217;ll cover option one here, since this makes things somewhat easier because you&#8217;re not adding additional virtual hardware.<br \/>\n<!--more--><\/p>\n<p>First, of course, you must increase the disk size in VMWare (shutdown the VM first):<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"http:\/\/www.ossintegrators.com\/blog\/wp-content\/uploads\/2014\/06\/061114_2158_AddingAddit1.png\" \/><\/p>\n<p>Then, start the VM, login as root and run the following command to verify that the OS sees the additional, un-partitioned space. Note the difference between the two red underlined sections \u2013 this is what we want.<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"http:\/\/www.ossintegrators.com\/blog\/wp-content\/uploads\/2014\/06\/061114_2158_AddingAddit2.png\" \/><\/p>\n<p>Now, create a new partition that covers all the free space. This is a multi-step process:<\/p>\n<ol>\n<li>Create a new primary partition on an available partition number (3 in this case).<\/li>\n<li>Change the partition type to &#8220;Linux LVM&#8221; (8e).<\/li>\n<li>Write the new partition table.<\/li>\n<li>Reboot to &#8220;enable&#8221; the new disk layout (while there are options to do this dynamically, we&#8217;ll keep it simple).<\/li>\n<\/ol>\n<p><img decoding=\"async\" alt=\"\" src=\"http:\/\/www.ossintegrators.com\/blog\/wp-content\/uploads\/2014\/06\/061114_2158_AddingAddit3.png\" \/><\/p>\n<p>Part 2 :<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"http:\/\/www.ossintegrators.com\/blog\/wp-content\/uploads\/2014\/06\/061114_2158_AddingAddit4.png\" \/><\/p>\n<p>Notice that I used the &#8220;p&#8221; command to print the new partition table \u2013 see how the red underlines (existing) partition has the correct type but &#8220;\/dev\/sda3&#8221; does not? Step #2 corrects that problem.<\/p>\n<p>Iinitialize the new partition for use by the Logical Volume Manager:<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"http:\/\/www.ossintegrators.com\/blog\/wp-content\/uploads\/2014\/06\/061114_2158_AddingAddit5.png\" \/><\/p>\n<p>Now, let&#8217;s add the new LVM-enabled partition into the existing data volume. Use the &#8220;pvs&#8221; command to find the volume name:<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"http:\/\/www.ossintegrators.com\/blog\/wp-content\/uploads\/2014\/06\/061114_2158_AddingAddit6.png\" \/><\/p>\n<p>Oops! Of course there&#8217;s no space on the device \u2013 that&#8217;s why we&#8217;re expanding it! Unfortunately, this means that you must free up some space (a few megabytes will do \u2013 delete some log files) and then re-run the command:<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"http:\/\/www.ossintegrators.com\/blog\/wp-content\/uploads\/2014\/06\/061114_2158_AddingAddit7.png\" \/><\/p>\n<p>Make note of the &#8220;LV Path&#8221; (underlined in red), because we are <em>finally<\/em> ready to actually make the drive larger! One last command:<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"http:\/\/www.ossintegrators.com\/blog\/wp-content\/uploads\/2014\/06\/061114_2158_AddingAddit8.png\" \/><\/p>\n<p>The &#8220;-r&#8221; option is crucial since it automatically runs the &#8220;resize2fs&#8221; command \u2013 if you forget this option than you&#8217;ll need to run the command manually.<\/p>\n<p>We now have successfully added additional disk space!<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"http:\/\/www.ossintegrators.com\/blog\/wp-content\/uploads\/2014\/06\/061114_2158_AddingAddit9.png\" \/><\/p>\n<p>The following links provide some useful additional information:<\/p>\n<ol>\n<li><a href=\"http:\/\/www.rootusers.com\/how-to-increase-the-size-of-a-linux-lvm-by-expanding-the-virtual-machine-disk\/\">Same basic info, but tells you how to avoid a reboot<\/a><\/li>\n<li><a href=\"http:\/\/www.funtoo.org\/LVM_Fun\">A tutorial\/walkthrough of LVM concepts if you want to know more<\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<div style=\"padding-bottom:20px; padding-top:10px;\" class=\"hupso-share-buttons\"><!-- Hupso Share Buttons - http:\/\/www.hupso.com\/share\/ --><a class=\"hupso_toolbar\" href=\"http:\/\/www.hupso.com\/share\/\"><img src=\"http:\/\/static.hupso.com\/share\/buttons\/share-small.png\" border=\"0\" style=\"padding-top:5px; float:left;\" alt=\"Share\"\/><\/a><script type=\"text\/javascript\">var hupso_services_t=new Array(\"Twitter\",\"Facebook\",\"Google Plus\",\"Linkedin\",\"Digg\",\"Reddit\");var hupso_toolbar_size_t=\"small\";var hupso_counters_lang = \"en_US\";var hupso_url_t=\"\";var hupso_title_t=\"Adding Additional Disk Space to an ESXi Boot Partition\";<\/script><script type=\"text\/javascript\" src=\"http:\/\/static.hupso.com\/share\/js\/share_toolbar.js\"><\/script><!-- Hupso Share Buttons --><\/div><p>This post aims to solve the most common issue that I&#8217;ve faced with our (admittedly not too large) ESXi infrastructure \u2013 how to add more drive space to a CentOS VM that only has one virtual HD. Strangely enough, this is more obtuse than it really should be! Note: this would be normally be completely [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1],"tags":[38,55],"class_list":["post-324","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-esxi","tag-vmware"],"_links":{"self":[{"href":"http:\/\/www.ossintegrators.com\/blog\/wp-json\/wp\/v2\/posts\/324","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.ossintegrators.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.ossintegrators.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.ossintegrators.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.ossintegrators.com\/blog\/wp-json\/wp\/v2\/comments?post=324"}],"version-history":[{"count":3,"href":"http:\/\/www.ossintegrators.com\/blog\/wp-json\/wp\/v2\/posts\/324\/revisions"}],"predecessor-version":[{"id":327,"href":"http:\/\/www.ossintegrators.com\/blog\/wp-json\/wp\/v2\/posts\/324\/revisions\/327"}],"wp:attachment":[{"href":"http:\/\/www.ossintegrators.com\/blog\/wp-json\/wp\/v2\/media?parent=324"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.ossintegrators.com\/blog\/wp-json\/wp\/v2\/categories?post=324"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.ossintegrators.com\/blog\/wp-json\/wp\/v2\/tags?post=324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}