{"id":195,"date":"2016-11-10T14:55:14","date_gmt":"2016-11-10T14:55:14","guid":{"rendered":"http:\/\/siteblog.tuc.gr\/emmanuel\/?p=195"},"modified":"2016-11-10T14:55:14","modified_gmt":"2016-11-10T14:55:14","slug":"disk-shrink-on-esxi-guests","status":"publish","type":"post","link":"https:\/\/siteblog.tuc.gr\/emmanuel\/disk-shrink-on-esxi-guests\/","title":{"rendered":"Disk shrink  on ESXi guests"},"content":{"rendered":"<ol>\n<li>Zero all unused space inside the VM:\n<p><code>dd if=\/dev\/zero bs=1048576 of=\/zero ; sync ; rm \/zero<\/code><\/li>\n<li>Do the same with other mount points, swap partitions, etc.<\/li>\n<li>Shut down the VM.<\/li>\n<li>SSH to ESXi, and issue this command:\n<p><code>vmkfstools -K \/vmfs\/volumes\/volumename\/vmname\/vmname.vmdk<\/code><\/li>\n<\/ol>\n<p>This will take some time&#8230; vmkfstools &#8220;punches holes&#8221; inside your VMDK, e.g. deallocates all blocks that are filled with zeros, effectively shrinking your VMDK.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/serverfault.com\/questions\/398162\/disk-shrink-does-not-work-on-esxi-guests\">http:\/\/serverfault.com\/questions\/398162\/disk-shrink-does-not-work-on-esxi-guests<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Zero all unused space inside the VM: dd if=\/dev\/zero bs=1048576 of=\/zero ; sync ; rm \/zero Do the same with other mount points, swap partitions, etc. Shut down the VM. SSH to ESXi, and issue this command: vmkfstools -K \/vmfs\/volumes\/volumename\/vmname\/vmname.vmdk This will take some time&#8230; vmkfstools &#8220;punches holes&#8221; inside your VMDK, e.g. deallocates all blocks [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[],"class_list":["post-195","post","type-post","status-publish","format-standard","hentry","category-vcenter-esxi"],"_links":{"self":[{"href":"https:\/\/siteblog.tuc.gr\/emmanuel\/wp-json\/wp\/v2\/posts\/195","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/siteblog.tuc.gr\/emmanuel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/siteblog.tuc.gr\/emmanuel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/siteblog.tuc.gr\/emmanuel\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/siteblog.tuc.gr\/emmanuel\/wp-json\/wp\/v2\/comments?post=195"}],"version-history":[{"count":1,"href":"https:\/\/siteblog.tuc.gr\/emmanuel\/wp-json\/wp\/v2\/posts\/195\/revisions"}],"predecessor-version":[{"id":196,"href":"https:\/\/siteblog.tuc.gr\/emmanuel\/wp-json\/wp\/v2\/posts\/195\/revisions\/196"}],"wp:attachment":[{"href":"https:\/\/siteblog.tuc.gr\/emmanuel\/wp-json\/wp\/v2\/media?parent=195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/siteblog.tuc.gr\/emmanuel\/wp-json\/wp\/v2\/categories?post=195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/siteblog.tuc.gr\/emmanuel\/wp-json\/wp\/v2\/tags?post=195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}