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 HKLM\SYSTEM\CurrentControlSet\services\FsDepends\Parameters.
  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 HKLM\SYSTEM\CurrentControlSet\services\FsDepends\Parameters /v VirtualDiskExpandOnMount /t REG_DWORD /d 4 /f