Forum Discussion

JFish1's avatar
JFish1
Copper Contributor
Jan 29, 2024

Hyper-V "Planned Virtual Machines" directory

Hi Folks,

 

Search attempts failed me, apologies if this is covered elsewhere.

 

Environment:

I have a standalone Hyper-V host with partitions:

  • C:\  [OS]   80GB
  • D:\  [Data]  ~900GB

Hyper-V Default Folders have been updated:

  • Set-VMHost -VirtualMachinePath 'd:\HyperV_VM'

  • Set-VMHost -VirtualHardDiskPath 'd:\HyperV_VM'

Issue:

Using Windows Admin Center, I attempted to import a previously exported VM located on D:\archive\

During the attempt, my C: drive was nearly completely consumed.

Trouble Shooting / Observations:

  • The export includes:
    - vhdx >100GB
    - VMRS >16GB

  • I attempted the import 3 times, during each attempt the verification stage was completed but the "import" button remained grayed out.  The last attempt triggered a low disk space warning.

  • During the importation process, the VM is staged under:
    C:\ProgramData\Microsoft\Windows\Hyper-V\Planned Virtual Machines\

  • I now have 3 copies of the VMRS file in "Planned Virtual Machines"
    The files are locked, I will try to reboot (or use safe mode) to access and delete the staged VMRS files.

Questions:

  1. During the importation process, is the VHDX transferred to "Planned Virtual Machines" directory?
    If so, this would explain the import failures; there is not enough space on the c:\ drive to temporarily host the vhdx.

  2. Is there a way to safely change (all) default "Planned" staging folders to the 😧 drive?
    I did not see a PowerShell setting, but it ma

  3. Any other advice to avoid this situation?

I appreciate the help.

3 Replies

  • DerpityDerpDerp's avatar
    DerpityDerpDerp
    Copper Contributor

    The answer to my quest is here: https://github.com/microsoft/Windows-classic-samples/blob/main/Samples/Hyper-V/Pvm/README.md

     

  • DerpityDerpDerp's avatar
    DerpityDerpDerp
    Copper Contributor

    Hyper-V Planned VMs are staged VMs in working memory the Hyper-V Service uses to create VMs from. The only way to unlock all the configuration files under the Planned VMs directory is by stopping the Hyper-V Management Service.

    I'm writing a script that does import / export through WMI and upon importing a configuration file (VMCX) a Planned VM is created with the, optionally new, GUID. My struggle now is trying to turn the Planned VM into a Computer Object so I can export the modified configuration or simply find a way to turn the Planned VM into a Regular VM in Hyper V through WMI.

     

    Good luck

  • JFish1's avatar
    JFish1
    Copper Contributor

    Update

     

    The above questions remain, but I recreated the conditions with a twist.  This generates more questions than answers . . .

    I created a new test export and imported onto a new test host.

    This time, prior to export, I stopped the VM.

    • As expected the VMRS file was significantly smaller (KB not GB).
    • Import took 2 tries (the first try relating to a missing vSwitch on the test host)
    • Once the import completed, I still see files in the "Planning" directory. They are locked and do not appear to auto-clear.  Some files are related to the failure and others may correlate to the successful import.

    How does one keep that Planning directory from accusing cruft? Does it auto-clean or require manual intervention (and if manual, how)?

    The Million Dollar Question:

    Barring an answer to the above questions, hopefully, there is still a way to move the "Planning" directories to the larger 😧 drive. 

Resources