In this video from ITFreeTraining, I will be looking at the files that are used with
Hyper-V. Understanding where these files are stored and what they are needed for will help
you when you backup or move virtual machines, and obtain the best performance you can out
of your virtual machines.
To start with, I will first look at the different file types that are used with Hyper-V. The
first file type that I will look at is XML. This is used to define the configuration used
in virtual machines and also the configuration used with checkpoints. The XML files themselves
do not contain any physical data used by the virtual machine, they are used to tell Hyper-V
where to find this data. For example, they would contain information about the virtual
hardware used in the virtual machine and also where to locate the virtual hard disks that
are used with the virtual machine.
The next file type is VHD and VHDX files. These two file types contain the data from
a virtual hard disk. If your virtual machine uses virtual hard disks, the XML file will
store the location of the VHD or VHDX file that contains this data. VHD is the older
file standard and VHDX file is the newer file standard. VHDX adds the ability to use larger
virtual hard disks and improves reliability and performance; however, it does require
Windows 8 or Windows Server 2012.
The next file type is AVHD and AVHDX. These files store checkpoint data. When you create
a checkpoint for the virtual machine, an AVHD file will be created if you are using VHD,
and an AVHDX file will be created if you are using a VHDX to store your virtual hard disks.
A checkpoint saves the current state of the virtual machine (including the memory used
in the virtual machine) which can be used later to restore the virtual machine back
to that state.
The next file type used with virtual machines is the BIN type. If you save the virtual machine,
the memory from the virtual machine will be saved in a BIN file. Saving the virtual machine
effectively stops the virtual machine. The virtual machine can then be started again
from where it was saved. This essentially provides the same functionality as checkpoints;
however, creating checkpoints can reduce the performance of the virtual machine whereas
saving the state does not. The advantage of checkpoints is that you can have more than
one, whereas saving the virtual machine essentially stops it, saves its state and allows it to
be started again at a later time.
The last file type is VSV. VSV is also used when the virtual machine is put into a saved
state. However, these are used for devices that are in use with the virtual machine.
So when a BIN file is created, a VSV file will be created as well.
I will now have a closer look at the files used with Hyper-V and where they are stored.
To do this, I will open Hyper-V manager. I have two virtual machines running on this
server. If I right click on the first virtual machine, I will select the option export.
Exporting the files required by the virtual machine will give us a good indication of
what files are required to run a virtual machine.
Once export has been selected, I will select the documents folder on this computer and
then press export.
Hyper-V is now exporting the virtual machine. Notice that the status of the virtual machine
is listed as exporting and a percentage of how much is complete. The process takes a
minute or two so I will pause the video and return shortly.
Now that the virtual machine has been exported, I will switch to windows explorer. You will
notice that, when I open the documents folder, I have a folder with the name of the virtual
machine that I exported. If I open this folder, you will notice that there are 3 more folders.
If I open the folder snapshots, you will notice that there are no files in this folder. This
is because this virtual machine has not had any checkpoints create as yet. In previous
versions of hyper-V, checkpoints were referred to as snapshots and thus the reason the folder
is named snapshots.
If I now go back and open the “Virtual Hard Disks” folder, you will notice that there
is one file in this folder since this virtual machine has the one virtual hard disk. By
default, Windows Explorer will not show the extension of this file. To show this, I will
select the view menu and then on the far right, select “Options” to bring up “Folder Options”.
If I now select the view tab, I will untick the option “Hide extensions for known file
types”. Once I press ok, notice that the extension for the file VHDX has now appeared,
so this virtual disk file is using the new virtual disk format supported by Windows 8
and Windows Server 2012 and above.
If I now go back to the previous folder, I will next open the folder “Virtual Machines”.
You can see in this folder there is the one XML file. This file contains the configuration
for the virtual machine. You will also notice that the filename is named after the GUID
of the virtual machine. The GUID is a unique number that is allocated to the virtual machine
when it is first created.
You can see that to have a functional virtual machine, all that was needed was a configuration
file and a virtual hard disk file. These were exported from the local server, so the next
step is to have a look at where these files are stored on the local server, and also the
other file types that are used with virtual machines.
If I now go back to Hyper-V Manager, I will right click the first virtual machine and
then select the option “Checkpoint”. A checkpoint saves that current state of the
virtual machine allowing it to be restored to this state later on. This includes the
current state of the memory and the contents of the virtual hard disk. You will notice
that, in this particular case, the virtual machine was not running; however, the check
point can still be created.
To see where Hyper-V stores its files, I will select the option on the right hand side “Hyper-V
Settings”. You will notice the first screen has the full file and path of where the virtual
hard disks are stored. I will now copy and paste this path into Windows Explorer.
You will notice that at the top is the VHDX file for the virtual machine. Under this is
the AVHDX file that contains the checkpoint data. Each time you create a checkpoint a
new AVHDX file is created. These are just files on the local hard disk, so the question
is how does Hyper-V know where to find these files and how does it know which checkpoint
files are associated with each virtual machine.
If I now go back into the Hyper-V Manager and open the Hyper-V settings, I will next
select the second section down “Virtual Machines”. This will show the folder where
the data for the virtual machine will be stored.
I will now copy and paste this path into Windows Explorer. You can see that, in this folder,
there are a lot of sub folders. In most cases, only a few of these folders will be used.
If I open the snapshots folder, you will notice that there is an XML file in this folder.
This contains the configuration data for the checkpoint. Remember that the data for the
checkpoint was in the other folder, so this file only contains the configuration for that
checkpoint.
If I now go back to the previous folder and then open the folder for “Virtual Machines”,
you can see the XML file that contains the configuration data for the virtual machine.
So you can see that configuration files are stored in one location while the data from
the virtual machines is stored in another location.
Now let’s go back to Hyper-V Manager. To demonstrate a point, I will right click the
first virtual machine and then select the “Delete” option to remove the virtual
machine from the server. Once I have confirmed that this is what I want to do, the virtual
machine appears to have been removed.
If I now select the option on the right hand side “Import Virtual Machine” this will
launch the import virtual machine wizard that will allow me to import the virtual machine
that I exported earlier.
Once I am past the welcome screen, on the next screen I need to browse to the location
that I exported that virtual machine to earlier. Once selected, I will move on to the next
screen of the wizard.
The next screen will state which virtual machines have been found, which, in this case, there
is only one.
On the next screen a decision needs to be made on how the virtual machine should be
imported. The first option will not copy or move the data files from their present location
but will use them in this location. In this case I don’t want to run the virtual machine
from this location.
The second option will restore the virtual machine to its default location, so I select
this option. The last option will copy the virtual machine but will create a new unique
ID. You would use this option if you wanted to duplicate the virtual machine and did not
want to risk having two virtual machines with the same unique ID.
On the next screen, I need to decide where to store the virtual machine configuration
and associated files. In this case, I will leave it on the default location and move
on to the next screen. On the next screen, I need to decide where to store the virtual
hard disk for the virtual machine. In this case, I will leave it on the defaults and
move on.
You will notice that I get an error message stating that the virtual hard disk already
exists. If I change to Windows Explorer and go to the virtual hard disk folder, you will
notice that the virtual hard disk file from the virtual machine is still present. In order
to import the virtual machine the virtual hard disk file needs to be removed, so I will
now remove the file. It is important to remember this fact when removing a virtual machine.
Even though the configuration files for the virtual machine have been removed, the virtual
hard disk containing all the data from that virtual machine may still remain.
Now that the virtual hard disk file has been removed, I will now close this error message
and move on to the next screen of the wizard.
On the last screen of the wizard, I need to press the finish button and this will start
the import. The process does take a little while to complete so I will pause the video
and return shortly.
Now that the import has been completed, you will notice that the virtual machine is now
listed with the other virtual machines.
There are still two other file types that are used with virtual machines that I have
not covered yet. To show these types of files, I will right click the virtual machine that
is currently running and select the option to pause. When a virtual machine is saved
or paused, some additional files are created.
If I go back to the Hyper-V Settings, I will copy and paste the folder location for the
virtual machines into Windows Explorer.
To see the other file types, I will open the folder “Virtual Machines”. To see the
remaining file types, I will need to open the folder that is named after the GUID of
the virtual machine.
In this folder you will see a BIN file. This file is a dump of the virtual machine when
it was paused so it should be the same size as the amount of memory the virtual machine
has allocated to it. The file below this, the VSV file, contains a dump of the current
state of the devices of the virtual machine. These files will only be created if the virtual
machine is paused. If, for example, you create a check point for a virtual machine, this
will save the current state of the memory and the current state of the devices; however,
it will not create BIN or VSV files. These files are only created when a virtual machine
is paused.
To end this video I will perform a quick summary of the major points. By default, the configuration
files for virtual machines are stored in the following location. The main file is the XML
file which contains details about the virtual machines and also details about and checkpoints
that are in use with the virtual machine.
The folder also contains the BIN and VSV files. These files are only used if the administrator
pauses or saves the virtual machine. So you can see that the data that is stored in this
folder should be quite small.
The next location is where the virtual hard disks are stored. These are the VHD and VHDX
files. If you create a checkpoint for the virtual machine, another file will be created
of the type AVHD or AVHDX, depending on what which type of virtual hard disk is being used.
As the administrator, you are free to change the default location of these files. It is
important also to understand where these files are stored so that when you are backing up
the virtual machines, the virtual machine’s backup data and configuration files are backed up.
I hope you have enjoyed this video from ITFreeTraining and found it useful. Please see our website
or YouTube channel for more videos on this course and others. Thanks for watching.