Q. When I boot from a dynamic Virtual Hard Disk (VHD), the VHD is expanded to its full size. Can I stop this?

John Savill

April 21, 2010

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A. Consider what the OS sees when booting from a VHD. It sees a VHD that has a certain size, such as 127GB. If you place the 127GB dynamic VHD on a 40GB partition, the disk would expand up to 40GB then fail to expand, causing the OS to have very serious problems. To avoid the possibility of the OS trying to write to the VHD when the physical disk is full, when you boot from a dynamic VHD, it's expanded to its full size, ensuring the space is available. When you close the OS, the VHD shrinks back to its dynamic size.

We can stop this behavior with a registry change, but you should do this with caution. Make sure you have some monitoring or alerting capability that will notify you when a disk reaches a certain disk usage threshold.

  1. Start the registry editor (regedit.exe).

  2. Move to HKLMSYSTEMCurrentControlSetservicesFsDependsParameters.

  3. Double-click VirtualDiskExpandOnMount and set to 4. Click OK.

  4. Reboot the machine and the VHD will no longer expand when booted.

You can use this command from the command line:

REG ADD HKLMSYSTEMCurrentControlSetservicesFsDependsParameters /v VirtualDiskExpandOnMount /t REG_DWORD /d 4 /f

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like