Converting to a fixed virtual hard disk–the hard way

Yesterday I showed you how to easily convert a dynamically expanding virtual hard disk to a fixed size virtual hard disk.  But, how do you do this if you want to keep your fixed size virtual hard disk as small as possible?  Well, here is the process that I use for my Windows Server 2008 R2 virtual machines:

 

  1. Login to the virtual machine using an administrative account
  2. Open Server Manager and select the Disk Management node under the Storage node.
  3. Right click on the partition that you want to shrink and select Shrink
  4. Select how much you want to shrink the partition by
    1. In my case I want to shrink a 250GB partition to 70GB:
      image
  5. Once you have shrunk the partition(s) open Windows Server Backup inside the virtual machine (if you have not installed this – you can do so by choosing to Add Features from Server Manager – don’t worry, this does not take up much space and does not require a reboot to install)
  6. In Windows Server Backup select Backup Once…
  7. This will open the Backup Once Wizard.  There is only one choice on the first page.  On the second page choose Full server
  8. Then select to store the backup on a Remote shared folder and provide a file share to use for storing the back
    1. I have a share setup on my parent partition for backing up virtual machines to when I am doing this
  9. Complete the wizard and wait for the backup to complete:
    image
  10. While the backup is going you can actually jump to the next step.  Creating a new fixed virtual hard disk
  11. Open the New Virtual Hard Disk Wizard
  12. Choose to create a new fixed size virtual hard disk that is the right size for your smaller partitions
    1. Here I am making a 70GB virtual hard disk for my WDS server:
      image
  13. Once the backup is complete, and the fixed virtual hard disk is created, shutdown the virtual machine
  14. Open the virtual machine settings and replace the dynamic virtual hard disks with the new fixed size virtual hard disks
  15. Boot the virtual machine using a Windows Server 2008 R2 installation DVD
  16. After choosing your language, choose Repair your computer (instead of clicking on Install now)     
  17. Then select Restore your computer using a system image that you created earlier and click Next
  18. Click Cancel on the warning that comes up, and then click Next followed by Advanced…
  19. Select Search for a system image on the network, followed by clicking Yes
  20. When prompted – enter the network path that you used to create the backup and click OK
  21. Select your backup from the table and click Next
  22. Select the disks you want to restore and click Next, Next, Finish and Yes
  23. The virtual machine will reboot automatically once the backup is restored

Once this is all complete, and once you have confirmed that the virtual machine is working properly, you can delete the dynamically expanding disk and the backup.

Cheers,
Ben

Comments

  • Anonymous
    December 29, 2011
    I think there is a simplier way to achieve this:
  1. Create fixed VHD with proper size
  2. Download LiveCD with partition cloning tool (gparted for example, or acronis, wich is more user friendly, but not free).
  3. Shutdown VM
  4. Attach second VHD you created in step 1
  5. Boot VM from LiveCD and copy patrition from 1st disk to 2nd with the tool you prefer
  6. Detach 1st dynamic VHD and LiveCd
  7. Power on VM with new fixed VHD. It should be much faster then creating/restoring backup, and guarantee no data loss (if you use backup the data can change right after backup has finished and before you shutdown VM). PS Sorry for bad english.
  • Anonymous
    December 29, 2011
    And, using dosk cloning tool allows you to change the size of partition anyway, while shrinking often does not work, because of previously written sectors in the end of disk.

  • Anonymous
    December 29, 2011
    Igor - Whenever possible I try to work with supported Microsoft tools.  Sooner or later I am going have a Microsoft developer looking at one of my virtual machines - so I want to make sure that everything is completely "above the board". Cheers, Ben

  • Anonymous
    December 29, 2011
    Hi I'm just curious how you. Puls shrink from 250gb to 70gb. Whenever i triest this with win2008r2 in the past i only could reisze it to the half... I tried defragment it which didn't work only Solution there was 3rdparty sw Or is there a hidden switch to get Disks smaller?

  • Anonymous
    January 22, 2012
    Is this method supported on domain controllers? Thanks!