Q. When I boot from a dynamic Virtual Hard Disk (VHD), the VHD is expanded to its full size. Can I stop this?
April 21, 2010
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.
Start the registry editor (regedit.exe).
Move to HKLMSYSTEMCurrentControlSetservicesFsDependsParameters.
Double-click VirtualDiskExpandOnMount and set to 4. Click OK.
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
You May Also Like