Hyper-V How To: Access the Properties of a Virtual Disk

A virtual machine views its disks as normal mass storage devices. In reality, they’re files. On the Hyper-V platform, the original format has an extension of VHD (for virtual hard disk) and the newer variant is VHDX. Of course, just knowing that they exist is often not enough. You’ll often find that you need to know specific details about a particular virtual disk file.

You can find these files in Windows Explorer and view a property sheet like you can for any file. For the traditional VHD file, the displayed information is very basic — not much different than a normal file. For VHDX files, there is an added Details tab with more information:

VHDX Properties in Windows Explorer

VHDX Properties in Windows Explorer

 

There really isn’t much useful information here. This particular VHDX is dynamically expanding, so the Size field shows what it is currently expanded to. However, this dialog doesn’t actually tell you that the disk is dynamically expanding; I just know that because it’s my system. The Computer field isn’t as useful as we might like, either. It simply shows the computer that supplied the information. If you are viewing a VHDX inside a Cluster Shared Volumes folder from node 1 and the virtual machine that owns it is running on node 2, the Computer field will show node 1. Likewise, if you remotely access a share on another computer and view the file’s properties that way, it will show the name of the computer that is hosting the VHDX in this field, not the computer running the virtual machine that it is attached to (unless they happen to be the same computer). Realistically, the most useful information on this page are the Date created and the Date modified fields. Knowing the creation date of a dynamically expanding disk can help you predict future expansion. Knowing when the file was last modified can be useful in a number of situations, especially when dealing with checkpoints and differencing disks.

Realistically, the properties provided by Windows Explorer will usually be unsatisfying. For one thing, you might not even know where a virtual disk is. Just browsing around for it works well enough when you have a general idea, but if you’ve got more than a few locations to check, that can quickly become tedious. You might be working with a virtual disk that’s unfamiliar to you, perhaps because someone else created it, so you might not know what type it is. If it’s a differencing disk, you might need to know which file is its parent. For this kind of information, you need something that can dig into the file more deeply than its NTFS metadata. Fortunately, Hyper-V Manager has functionality that can do just that.

Accessing a Virtual Machine’s Virtual Disk Settings

If the virtual disk you’d like to view is attached to a virtual machine, the fastest way is likely through the virtual machine’s settings dialog.

  1. In Hyper-V Manager’s center pane, right-click the virtual that owns the disk you want view and click Settings.
    Access VM Settings

    Access VM Settings

     

  2. In the VM’s settings dialog, locate the disk that you wish to view in the left pane. In the right pane, click the Inspect button. Regardless of the state of the virtual machine (barring error conditions), this button should always be available.
    VM Dialog: VHD Inspect Button

    VM Dialog: VHD Inspect Button

     

  3. Skip down to the VHD Inspect Dialog section for coverage of the dialog that pops up.

Accessing a Standalone Virtual Disk’s Settings

Hyper-V Manager can retrieve the settings for any VHD file that the host has access to, even if it’s not attached to a virtual machine. You’ll need to be able to browse to it manually. This technique works for virtual hard disks that are attached to VMs as well, although it’s less convenient than the above method.

  1. In Hyper-V Manager’s right-hand Actions pane, click the Inspect Disk link.
    Actions Pane VHD Inspect

    Actions Pane VHD Inspect

     

  2. You’ll be presented with a file browse dialog that only accepts VHD and VHDX and their automatically generated relatives (AVHD and AVHDX, respectively) files as input. It will default to the host’s default virtual hard disk location, but you can use the standard navigation tools to redirect it anywhere you need to look. For remote shares, start by entering the host name into the top address bar in the format of \hostnameshare to switch to that location.
    Browse for VHD

    Browse for VHD

     

  3. Upon clicking OK, the inspect dialog will open. Jump to the next section to learn about it.

The Virtual Hard Disk Properties Dialog

Whichever method you followed about, you should now be looking at the Virtual Hard Disk Properties dialog window. In both of my directions above, I chose the same VHDX to use as an example. Its property dialog appears below:

Inspect Differencing VHD

Inspect Differencing VHD

 

The first field shows that this is a VHDX format disk as opposed to the earlier VHD format. As you can see in the next field, I deliberately chose to use a differencing disk for example purposes. The next two fields give the location and name of the file, respectively, although you had to have already noticed those in the previous steps to get to this dialog. The Current File Size and Maximum Disk Size fields should be self-explanatory; they’ll both contain the same value for a fixed size VHD. The final field, Parent, is only shown for differencing disks, as is the Inspect Parent… button.

Clicking the Inspect Parent button for the above VHD yields the following:

Inspect Dynamic VHD

Inspect Dynamic VHD

 

As you can see, it looks almost identical to the differencing disk‘s inspect dialog, with the exception of the parent items.

Disk Inspection Notes

A few things to note about disk inspection:

  • Although the word “inspect” might carry certain connotations, this process only scans the VHD/X header data for information. It does not perform any scan of the data region for corruption.
  • For the same reasoning as the prior, the inspect action cannot tell you the amount of space that can be saved by compacting a dynamically expanding virtual disk.
  • As you’ve seen, a differencing disk’s inspection page can identify its parent, but the reverse is not true. The major reason for this is that the header of the base VHD does not include any information about any children. Another practical reason is that a single base disk can have any number of children, which would be difficult to track from its perspective.
  • While you may be accustomed to seeing differencing disks with the A prefix (AVHD and AVHDX), this only signifies that the file was automatically created by a checkpoint process. If a differencing disk is manually created, there is no technique to detect this using Windows Explorer or standard file browsing tools. The only guaranteed way to know if a virtual disk is fixed size, dynamically expanding, or differencing is to use the Inspect method shown here (or the Get-Vhd PowerShell cmdlet, or some other tool that can parse the VHD/X header).

 

Altaro Hyper-V Backup
Share this post

Not a DOJO Member yet?

Join thousands of other IT pros and receive a weekly roundup email with the latest content & updates!

Leave a comment or ask a question

Your email address will not be published. Required fields are marked *

Your email address will not be published.

Notify me of follow-up replies via email

Yes, I would like to receive new blog posts by email

What is the color of grass?

Please note: If you’re not already a member on the Dojo Forums you will create a new account and receive an activation email.