{"id":374,"date":"2015-04-12T12:23:12","date_gmt":"2015-04-12T19:23:12","guid":{"rendered":"http:\/\/eriknovales.com\/blog\/?p=374"},"modified":"2015-04-12T12:23:12","modified_gmt":"2015-04-12T19:23:12","slug":"compacting-a-vhd","status":"publish","type":"post","link":"https:\/\/eriknovales.com\/?p=374","title":{"rendered":"Compacting a VHD"},"content":{"rendered":"<p>I was looking to back up some VHD containers that I use to store files in Windows, and needed to trim one of them down before it would fit under the <a href=\"http:\/\/onedrive.live.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">OneDrive<\/a> 10 GB upload limit. Since it was a dynamically expanding VHD, just removing files from the container wasn&#8217;t sufficient to reduce the actual size of the VHD file. Once I was done, I needed to unmount the drive, and then compact it using the <strong>diskpart<\/strong> utility. Here are the steps I followed:<\/p>\n<ol>\n<li>Run the <code>diskpart<\/code> command from a command prompt.<\/li>\n<li>Enter <code>select vdisk file=\"<em>path to VHD file<\/em>\"<\/code>.<\/li>\n<li>Enter <code>attach vdisk readonly<\/code>.<\/li>\n<li>Enter <code>compact vdisk<\/code>. This will compact the VHD file, and might take a little while.<\/li>\n<li>Finally, enter <code>detach vdisk<\/code> and then <code>exit<\/code>. This will detach the VHD file and exit <strong>diskpart<\/strong>.<\/li>\n<\/ol>\n<p>Once this is done, your VHD size should be reduced to the minimum necessary to store the files within!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was looking to back up some VHD containers that I use to store files in Windows, and needed to trim one of them down before it would fit under the OneDrive 10 GB upload limit. Since it was a dynamically expanding VHD, just removing files from the container wasn&#8217;t sufficient to reduce the actual [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[6],"tags":[],"class_list":["post-374","post","type-post","status-publish","format-standard","hentry","category-computing"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/eriknovales.com\/index.php?rest_route=\/wp\/v2\/posts\/374","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eriknovales.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eriknovales.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eriknovales.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eriknovales.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=374"}],"version-history":[{"count":0,"href":"https:\/\/eriknovales.com\/index.php?rest_route=\/wp\/v2\/posts\/374\/revisions"}],"wp:attachment":[{"href":"https:\/\/eriknovales.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=374"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eriknovales.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=374"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eriknovales.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}