none
Customizing Hyper-V VMs folder structure?

    Question

  • I'm hoping there is the ability to use the name of the VM being created to manage how the folders & directories are created?

    Instead of:
    C:\ClusterStorage\Volume1\Hyper-V\Hardrives
    C:\ClusterStorage\Volume1\Hyper-V\VMs

    I would like to have something along the lines of:
    C:\ClusterStorage\Volume1\Hyper-V\%vm_name%\Hardrive
    C:\ClusterStorage\Volume1\Hyper-V\%vm_name%\VM

    Just to keep things neat and orderly and resembling more the folder layout after exporting / importing a VM without actually having to go through that process.
    Tuesday, October 05, 2010 11:19 PM

Answers

  • Hi,

     

    If I understand clearly, you want to keep different VMs in their own folders. For example, the VHDs and configuration files of the virtual machine VM01 are all stored in C:\ClusterStorage\Volume1\Hyper-V\VM01.

     

    If so, you can perform Alessandro’s suggestion to modify the default VHD folder and virtual machine configuration file folder in Hyper-V Settings. You can also specify the path you want when you create a new VM by check the box “Store the virtual machine in a different location”. I always use this method because I have to create some VMs where the path is not in the CSV folder.

     

     

     

    Best Regards,

    Vincent Hu

     

    Wednesday, October 06, 2010 3:03 AM

All replies

  • CSV volumes are stored as directories and subdirectories beneath the ClusterStorage root folder, which typically exists on the root of C: to provide a consistent file namespace to all Hyper-V cluster nodes. This ensures any VMs stored on a CSV have the same name and path from any cluster node.

    Hyper-V consists of the following default file configuration locations for storing virtual machine files:

    • Default virtual hard disk storage location - C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks
    • Default virtual machine storage location - C:\ProgramData\Microsoft\Windows\Hyper-V

    These can be modified using the Hyper-V Settings option in the Hyper-V Manager MMC or when you build a virtual machine, install into a CSV and choose the option : "Share the virtual machine in a different location" and then specify the name of the folder you want, e.g. name of the machine.

     


    If this post is helpful, please mark it as such
    ________________________________________
    Alessandro Cardoso
    MVP | Microsoft Heroes | MCT
    blog: http://virtualisationandmanagement.wordpress.com
    http://virtualizacaoegerenciamento.wordpress.com
    • Proposed as answer by AlessandroCardosoMVP Wednesday, October 06, 2010 6:09 AM
    • Unproposed as answer by Cheshire43 Wednesday, October 06, 2010 6:54 PM
    Tuesday, October 05, 2010 11:36 PM
  • Being able to use a property to define the folder name would make that easier as opposed to doing it manually for each VM?
    Wednesday, October 06, 2010 2:48 AM
  • Hi,

     

    If I understand clearly, you want to keep different VMs in their own folders. For example, the VHDs and configuration files of the virtual machine VM01 are all stored in C:\ClusterStorage\Volume1\Hyper-V\VM01.

     

    If so, you can perform Alessandro’s suggestion to modify the default VHD folder and virtual machine configuration file folder in Hyper-V Settings. You can also specify the path you want when you create a new VM by check the box “Store the virtual machine in a different location”. I always use this method because I have to create some VMs where the path is not in the CSV folder.

     

     

     

    Best Regards,

    Vincent Hu

     

    Wednesday, October 06, 2010 3:03 AM
  • Thank you for the replies,

    Yes I want to store the VMs in different folders,  but I do not want to have to create / specify that folder myself every time I create a VM.

    I was asking if there was a way to, by default, use the VM's name as a variable to define the folder in which it would be stored.

    So instead of specifying the default directory as something like ' C:\ClusterStorage\Volume1\Hyper-V\VMs ', one could specify ' C:\ClusterStorage\Volume1\<VMname> ' as the root directory, so that if a VM named Server1-VM is created, it will be reinterpreted as 'C:\ClusterStorage\Volume1\Server1-VM, and if a VM named Server2-VM is created, it would refer to ' C:\ClusterStorage\Volume1\Server2-VM ' as the folder.

    Wednesday, October 06, 2010 7:04 PM
  • Hi,

     

    As you can see in the screen shot in my last reply. If you saved VMs in D:\VMs for one time, such as VM01, it will be saved as D:\VMs\VM01. Later, if you create the second VM named VM02, just type the name in “Name”, it will be saved in D:\VMs\VM02 automaticlly, you don’t have to specified the location again.

     

     

    Best Regards,

    Vincent Hu

     

    Monday, October 11, 2010 6:18 AM
  • Hi,

    I ended up came up with the following solution for this:

    1. Create 1 VM folders (C:\VMs_1\ for temporary place holder, C:\VMs_2 for permanent/final VM location)
    2. Set default folder for VM and Virtual Disks to C:\VMs_1
    3. Create a VM (e.g. Test1) with default settings
    4. The result will be messy (XML on C:\VMs_1\Virtual Machines\, VHD on root of C:\VMs_1)
    5. Before you do anything, export it to C:\VMs_2\ (no VM name at the end as it gets appended automatically)
    6. Delete the current VM on Hyper-V Manager
    7. Delete actual files under C:\VMs_1\* (Otherwise, they will be left behind and will confuse you later for the next time)
    8. Import the VM from C:\VMs_2\[VMName]\ folder

    I hope that it is better on SCVMM 2012 or gives us some option based on everyone's preference....

    Thanks,


    YPae

    Saturday, May 26, 2012 6:44 PM
  • its more than a year to this post but i am still looking for similar solutions.

    I want to create VMs from SCVMM 2012 SP1 but want the .vhds to be stored in the "Virtual Hard Disk" folder instead of root folder for the VM. 

    I know when you create a VM from Hyper-v Manager it store the vhd in that folder but not in SCVMM.

    I wants this because

    a) clean and tidy

    b) Registering bulk  VMs from powershell in another Hyper-v as DR is quick as if the VHD is not "virtual Hard Disks" folder it will fail with no hd found.

    any help appreciated.

    TA

    Wednesday, August 21, 2013 3:12 PM