Hyper-V

Default Hyper-V Storage Paths Explained

In my travels, I have noticed that the default storage paths used by Hyper-V can cause some confusion. To be honest, I don’t like how Hyper-V stores virtual machines by default; System Center Virtual Machine Manager (SCVMM) handles the folder structure in a much more attractive fashion. In this post, I will explain where Hyper-V stores virtual machine files by default, and how you can manipulate those settings to get a better configuration.

Hyper-V Storage Path Settings

There are two default storage paths defined in each host’s Hyper-V settings. You can find and edit these paths by opening Hyper-V Manager, connecting to and selecting your host, and choosing Hyper-V Settings from Actions. Here you will find two settings.

Virtual Hard Disks is the default storage location for any new virtual hard disk that you create. The default location is C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks. Checkpoints (AVHD or AVHDX files) will also be stored in this location.

Virtual Machines is where the XML file (named after the GUID of the virtual machine) for a virtual machine configuration will be stored. The default location for those XML files is C:\ProgramData\Microsoft\Windows\Hyper-V. BIN files (to reserve space for virtual machines that will enter a saved state when a host shuts down) and VSV files (a saved state) are stored in a subfolder that is named after the GUID of the virtual machine.

Sponsored Content

Passwords Haven’t Disappeared Yet

123456. Qwerty. Iloveyou. No, these are not exercises for people who are brand new to typing. Shockingly, they are among the most common passwords that end users choose in 2021. Research has found that the average business user must manually type out, or copy/paste, the credentials to 154 websites per month. We repeatedly got one question that surprised us: “Why would I ever trust a third party with control of my network?

When you think about it, both of those locations are pretty dumb. On a nonclustered host, you should never store virtual machines on the system drive. And who thinks it’s a good idea to bury virtual machine and virtual hard disks in program and profile folders?

The default Hyper-V storage paths
Virtual hard disks and virtual machines storage paths

Microsoft cannot predict what kind of storage you will supply and where it will be located so it is up to us to supply better paths. In the cause of a non-clustered host with internal storage I will have a second volume (RAID 10 array) labelled as the D: drive. I will create a folder there called Virtual Machines. I then edit the Hyper-V settings of the host, and reconfigure both the Virtual Hard Disks and the Virtual Machines folders to point to D:\Virtual Machines.

It’s a bit trickier when you are dealing with more complex installations. I could say that you should use SCVMM in those scenarios and it will do a good job and using the correct storage for you. But not everyone can afford System Center. So in that case, maybe you should reconfigure the default paths to the location of your preferred CSV or SMB 3.0 volume.

Virtual Machine File Locations

Once in a while I will visit a site and find that all of their virtual machine XML and virtual hard disk files are in a single folder and a rather untidy flat file structure. It takes some time to figure out what XML file is associate with what virtual machine, and the file is named after the GUID of the virtual machine. I would not classify myself as a clean freak, but I cannot stand this layout. And it really annoys me that Hyper-V steers you into this direction.

The below screenshot is taken from the New Virtual Machine Wizard in Hyper-V Manager. An administrator will enter the name of the new virtual machine. If they do not check the Store The Virtual Machine in a Different Location box, then they get a rather untidy collection of files.

New Virtual Machine Wizard
The New Virtual Machine Wizard

The next screenshot shows you what the Virtual Machines folder would look like. Each virtual hard disk was created using the wizard, so they are named after the attached virtual machine by default.

The default method of storing Hyper-V virtual hard disks
A flat, messy collection of virtual machine storage files

The contents of the Virtual Machine subfolder is a mess, as is the contents of the Snapshots subfolder. You will need to know the GUIDs of each virtual machine to know what file is owned by what virtual machine.

The default method of storing Hyper-V VM XML files

You can prevent this mess if you check the Store The Virtual Machine in a Different Location box in the New Virtual Machine Wizard. All you have to do is check that box, and the wizard will create a subfolder, named after the virtual machine, to store all of that virtual machines files. If you create 10 virtual machines, then you get 10 subfolders in the Virtual Machine path that is configured in Hyper-V Settings.

correct way to store Hyper-V VM files
Storing virtual machines in tidy subfolders

The virtual machine folder will contain two subfolders by default. Virtual Machines is where the XML file is stored. Virtual Hard Disks is where the virtual machine’s VHD or VHDX files are kept. And Snapshots is where the checkpoint (formerly known in Hyper-V Manager as a snapshot) is kept. The BIN and VSV files continue to be kept in a subfolder of Virtual Machines named after the GUID of the virtual machine.

So my advice is simple:

  1. Reconfigure the default storage paths in Hyper-V Manager.
  2. Always check the box to Store The Virtual Machine in a Different Location in the New Virtual Machine Wizard.

Related Topics:

BECOME A PETRI MEMBER:

Don't have a login but want to join the conversation? Sign up for a Petri Account

Register
Comments (3)

3 responses to “Default Hyper-V Storage Paths Explained”

  1. Great insights. I briefly mentioned this problem in my own blog a while big, albeit no where near in as much detail. Whats worse is that SOMETIMES you get one behavior, and other times you don’t. Your advice on storing them in separate places is the simplest answer I’ve seen.

  2. I agree with this advice and follow it for managing VMs on Hyper-V hosts with shared storage as well as my personal Win 8.1 computer. I would perhaps caveat this advice for hosts without shared storage by advising that Live Migration won’t follow your naming convention by default. Using Live Migration (and you really should), if you want to move a VM sitting under a particular naming convention, i.e. not the default save locations for disk and machine, then you’ll have to recreate that naming convention on the destination host and select it during the Live Migration wizard. It’s a minor inconvenience but hopefully one that nudges you towards looking at shared storage and SMB3. If you haven’t already done so, check out Aiden’s many articles on a Scale Out File Server.

Leave a Reply

Aidan Finn, Microsoft Most Valuable Professional (MVP), has been working in IT since 1996. He has worked as a consultant and administrator for the likes of Innofactor Norway, Amdahl DMR, Fujitsu, Barclays and Hypo Real Estate Bank International where he dealt with large and complex IT infrastructures and MicroWarehouse Ltd. where he worked with Microsoft partners in the small/medium business space.
Live Webinar - Thursday, December 2nd! Active Directory Masterclass: AD Configuration Strategies for Stronger SecurityREGISTER NOW - Thursday, December 2, 2021 @ 1 pm ET

Active Directory (AD) is leveraged by over 90% of enterprises worldwide as the authentication and authorization hub of their IT infrastructure—but its inherent complexity leaves it prone to misconfigurations that can allow attackers to slip into your network and wreak havoc. 

Join this session with Microsoft MVP and MCT Sander Berkouwer, who will explore:

  • Whether you should upgrade your domain controllers to Windows Server
    2019 and beyond
  • Achieving mission impossible: updating DCs within 48 hours
  • How to disable legacy protocols and outdated compatibility options in
    Active Directory

Sponsored by: