When creating a Hyper-V checkpoint, it is crucial to know where the checkpoint files are being saved, especially since checkpoint files can fill up storage. When trying to find where the checkpoint files are being stored in your Hyper-V environment, it is important to understand what types of files are generated when creating a checkpoint. This is because components of the checkpoint are stored in two separate locations. The AVHDX file is stored with the VHD storage and the checkpoint configuration files are stored with the VM’s active configuration files.
Hyper-V Checkpoint Configuration Files
The checkpoint configuration files are the files that store the settings and state of the VM at the point in time when the checkpoint is created. They consist of an XML file, a .BIN file, and a .VSV file. By default they are stored in the following location:
If you want to double check where the checkpoint files are being stored in your Hyper-V environment, open up Hyper-V Manager, right click on your host, and select Hyper-V settings:
On the left hand side, select Virtual Machines. The location of your checkpoints will be the path that is displayed on the right hand side:
In my example, I have my host configured to save the VM configuration files (and checkpoint configuration files) to:
When the first checkpoint is created, a sub folder called “Snapshots” is automatically created in this path. If we take a look at that location we can see the files that are stored when a Hyper-V checkpoint is created. Also note that for each checkpoint a folder is created and named with the checkpoint GUID. An XML file with the same GUID naming scheme is created at the root of the snapshots folder:
This XML file contains all the information about the VM configuration, such as the resource information, checkpoint locations, etc. Right now I have two checkpoints created for a single VM. I have changed the resources assigned to the VM in between each checkpoint. If I open up both XML files and search for memory, I can see the value for assigned memory size is different for each checkpoint state:
Looking deeper into the checkpoint folder structure, within each GUID checkpoint folder, there is a BIN and VSV file:
The BIN and VSV files contains the memory contents and the device state, respectively, of the VM when the Hyper-V checkpoint was created. Because these files essentially save information pertaining to the running state of the VM, these files are only created if the checkpoint was taken while the VM was powered on. So, if the VM was powered off while all checkpoints were taken, there would be no VSV or BIN files.
AVHDX File Location
The AVHDX file is stored in a separate location. This is the differencing disk file that is used for the checkpoint. All change data is written to this disk and the default stored location depends on the OS version:
Windows Server 2012R2 or Windows 8.1 – C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks
Windows Server 2012 and Windows 8 – C:\ProgramData\Microsoft\Windows\Hyper-V\New Virtual Machine\Virtual Hard Disks
To change the default location, right click on the Hyper-V host and select Hyper-V Settings again. This time on the left hand side select Virtual Hard Disks. The default location will be displayed on the right hand side:
In this example, I’ve changed the default location to be:
If we look in this folder we can see the AVHDX file created for each checkpoint created for the Luke-APP VM:
Changing Default Save Locations for Multiple Hyper-V Hosts
Unless you have System Center Virtual Machine Manager, you will have to manually change the default location for VMs and VHDs on each host. If you have 20 hosts, that gets a little tedious. Luckily, PowerShell can help us change this setting easily.
To change the default virtual hard disk path on multiple hosts we’ll use the Set-VMHost cmdlet. First we need to get a list of our Hyper-V hosts to reference in the cmdlet. Depending on how large of list of Hyper-V hosts you have, you can either use a CSV file or simply type in the names of the hosts. In this example, I will make a variable listing my two Hyper-V hosts by typing the following command:
$hosts = "Luke-HV03","Luke-HV04"
Just to make sure the variable contains all of our hosts we will enter the $host variable into the console to confirm:
To change the path of the default folder for VHDs simply type the following command:
Set-VMHost –ComputerName $hosts –VirtualHardDiskPath “C:\ClusterStorage\Volume1\NewVHDs"
To change the path of the default folder for storing virtual machine configuration files, type in the following command:
Set-VMHost –ComputerName $hosts –VirtualMachinePath “C:\ClusterStorage\Volume1\NewVMs"
Now when we look at the default locations for both settings on our hosts they show the updated changes:
Note that the folders must already be created and accessible by each host in order to set the default folder to be that location.