Tips
Diagnosing VHD Mount Errors
Here's how to troubleshoot VHD Mount failures.
VHD Mount, described in my article "
Virtual
Server 2005 R2 SP1 Treasures: VHD Mount,"is a tool that allows
you to locally mount Virtual Server or Virtual PC .vhd virtual hard disk
files on a Windows Server 2003 system. While VHD Mount is a great tool,
what can you do if it fails to successfully mount a virtual hard disk?
Ben Armstrong recently unlocked the door to this mystery in
his
blog.
If you run VHD Mount with the wrong syntax and the command fails to execute,
the command will return help information for the command's syntax.
If you are using the correct syntax -- such as vhdmount
/m /f D:\XPVM\XP.vhd V -- and the command fails to mount the virtual
hard disk, it will generate a relatively straightforward error message.
For example, if you might be mounting a corrupt VHD file and you get the
error message "The specified file is not a valid VHD."
To get more granular detail on the VHD Mount process, you can enable
VHD Mount tracing. To do this, you just need to create a VHD_Mount_Trace
environment variable and set it to 1 by running the following command:
set vhd_mount_trace=1
Once you've enabled VHD Mount tracing, you should then rerun the VHD
Mount command that failed to mount a VHD file and view the verbose command
output. Here is the resultant output from a failed vhdmount command:
C:\Program Files\Microsoft Virtual Server\Vhdmount>vhdmount
/m /f c:\test1.vhd x
[Info] Default user locale is 0x409
[Error] PathFileExists failed with error code = 0x2
The specified Virtual Hard Disk could not be found.
[Error] VHDMount failed with return code = 3
While the above is a simple example, it represents VHD Mount tracing
in action. I've found VHD hard disks to be extremely reliable and
have had little trouble with VHD Mount as well. However, it's good
to reserve a spot in your brain's hard disk for VHD Mount tracing.
You never know when you'll need it.
Thanks again to Ben Armstrong for bringing attention to this handy variable.