NetworkSydney

Shrinking a Windows disk and VHD

by Harry on Jun.30, 2010, under Virtualization

Hi All,

The Microsoft way to P2V a machine is by using Microsoft SCVMM. System Center Virtual Machine Manager has the ability to do online and offline P2V’s using clever boot.ini file modifications. So far both methods work well for me, however, in the field you see a lot of physical servers with over allocated disk space on both boot and data drives/volumes. Since we are all for saving money with virtualisation and that virtualisation offers us greater flexibility, why not reclaim that space and use it for other purposes.

The problem I’ve come across is that you’re not able to reduce the size of the disk when performing a P2V conversion with Microsoft VMM, or any other tool so far for that matter. You can increase the size but can’t decrease. I think this is a huge pitfall for Microsoft if you compare with VMware Converter. After doing some research (googling) I that the following is one way of shrinking the disks. Also note that we are reducing the size of the Windows volume within the VHD and the size of the VHD as well which is different to the compacting option. The compacting option will regain blank space in an ‘inflated’ dynamic disk;

  1. Use diskpart and the shrink command to shrink the last partition on the disk. You can also use shrink querymax to determine how much it can be shrinked.
  2. Use the vhdresizer tool to reduce the size of the vhd.

Note: the shrink command can only shrink upto a certain point, at which point an event is logged in the Application Log described which file is can’t be moved. Sometimes files such as system restore or indexing service may be the owner of these files. Disable such services may get you around diskpart not being able to move these files

:, , , , , , ,

Leave a Reply

You must be logged in to post a comment.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...