Best practices for file layout in a Hyper-V server?

You really, really want to be able to easily identify which files belong to which virtual machine. Even if you lose access to the Hyper-V console.

This comes up when trying to restore a VM from backups. Or when Hyper-V forgets about all of your VMs and you need to import them. Or the VM config files are corrupt, and you have to recreate the VM and point at the old hard drive files (which you now can't identify, since your config file is corrupt). Or you just want to quickly check how much disk space each VM takes up. Or you need to restore from backups where you can see the filenames, but not easily read the XML files without going through the entire restore process first.

Given that, I'd go for something similar to Template 1, where there is a folder for each VM - but leave out the "Virtual Machines" and "Virtual Machine Hard Disks" subfolders - just put all the files related to a VM in a folder with the VM's name.

You also don't need Hyper-V\Virtual machines - pick one of those labels, you don't need both.

So:

D:\Virtual Machines\MACHINE_A\GUID_1.xml
D:\Virtual Machines\MACHINE_A\Machine_a_OS.vhdx
D:\Virtual Machines\MACHINE_A\Machine_a_Data.vhdx

D:\Virtual Machines\MACHINE_B\GUID_2.xml
D:\Virtual Machines\MACHINE_B\Machine_b_OS.vhdx
D:\Virtual Machines\MACHINE_B\Machine_b_Data.vhdx

etc.

Or you might decide you don't need the filenames to match the virtual machine - the folder name is sufficient. Naming it this way would make it easier to clone a VM without having to worry about renaming it's files:

D:\VMs\Machine A\GUID_1.xml
D:\VMs\Machine A\OS.vhdx
D:\VMs\Machine A\Data.vhdx

D:\VMs\Machine B\GUID_2.xml
D:\VMs\Machine B\OS.vhdx
D:\VMs\Machine B\SQLData.vhdx
D:\VMs\Machine B\SQLLog.vhdx

The main takeaway here is to organize the files so that by looking at nothing else but the file structure, you can tell what VM each file belongs to, and what that file is for.


I like none.

Because none of your templates is stable in case you move a VM.

I would - and I do that myself - use a folder structure identical to the one you get when you mvoe a VM between hosts. That way nothing changes when - you move a VM between hosts.