Home > SQL / BI > Shrinking a fixed-size VHD file

Shrinking a fixed-size VHD file

In playing around with the new Azure Virtual Machines I wanted to upload an existing demo VM. It was a dynamically expanding VHD capped at 250Gb, but Azure only accepts fixed-size disks, and I certainly didn’t want to upload anything larger than was necessary. So to convert and shrink the drive I had to go through a slightly convoluted process:

1. Compact the file through Hyper-V, and then Convert it to a Fixed size (use the Inspect Disk option in the right-hand pane of Hyper-V management console)


2. Boot into a Win PE environment in the VM, so you can get to the DiskPart utility. You need to select the relevant volume (SELECT VOLUME x), then run SHRINK to take the volume down to the size required. Bear in mind you probably want some extra overhead for growth again! After this you can turn the VM off again.

3. Download VHDResizer from http://vmtoolkit.com/files/folders/converters/entry87.aspx, this allows you to resize the VHD:


Categories: SQL / BI
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: