The moment Windows 7 was out for trial I downloaded my copy from MSDN and started preparing my computer for fresh installation of new operating system. Of course, I made several backups. First, I created full computer backup (all partitions) on external USB drive using Windows Vista Backup utility so I can revert to Vista if anything goes bad, and also I copied all my documents, downloaded files etc. to a folder on an external USB drive.
My first attempt was to upgrade my Vista installation to Windows 7. It took almost 4 hour to upgrade (disk had 2 partitions, 50 % full), and after that my computer was dragging around like a dead cat. 🙂
I repartitioned my disk into two new partitions (previous BitLocker problems :)). Next up was full format of C: partition and fresh installation, which took no more than 40 minutes. Now was time to install all applications and to set them up. As I expected, some drivers had to be download from manufacturers site (card reader, bluetooth). And now to the fun part! Windows 7 Backup utility cannot restore data from Vista Backup. 🙂 Oh joy! Complete data from D: partition was lost! The only thing I could do at that moment was full restore of previously backed up Vista. And then, the moment of clarity! Microsoft Virtual Server 2005 R2 SP1 has utility which can mount vhd files as local disk drives! And Vista Backup is nothing more than vhd file!!! 🙂
So how does that “vhdmount” utility works ?!
Vhdmount is command line utility which can mount, dismount, commit or discard changes to vhd files that are mounted as local disk drives. Some of available switches are:
/p – Plugs in the specified VHD as a virtual disk device without mounting the volume.
/m – Plugs in the specified VHD as a virtual disk device and mounts the volume.
/f – Performs the specified operation without creating an Undo Disk. This parameter is applicable for /p and /m. All changes to the mounted disk are directly written to the specified VHD.
/u – Unplugs the virtual disk device for the specified VHDFileName.
/c – Updates the original VHD with all changes that were stored in the Undo Disk anddeletes the Undo Disk after unplugging the disk. This parameter is only applicable if the VHD was mounted without using /f.
/d – Discards all changes to the mounted disk and deletes the Undo Disk after unplugging the disk. This parameter is only applicable if the VHD was mounted without using /f.
/q – Displays the disk name of the mounted virtual disk device for the specified VHDFileNam
VHDFileName – VHD name including full path.
DriveLetter – Optional parameter for /m option. If drive letter is specified the volumes are mounted starting at the specified drive letter. If drive letter is not specifiedit is automatically assigned.
All – Applies the operation on all mounted virtual disk devices. This parameter is applicable for /u and /q.
By default, VHDMount creates an Undo Disk in current user’s temporary folder. All changes to the mounted disk are written to this Undo Disk. Use /c to commit or /d to discard these changes at the time of unplugging the disk device. Use /f option to mount a VHD without an Undo Disk.
VHDMOUNT /p [/f] VHDFileName
VHDMOUNT /m [/f] VHDFileName [DriveLetter]
VHDMOUNT /u [/c | /d] VHDFileName | All
VHDMOUNT /q VHDFileName | All
With help from Ben Armstrong, Program Manager on core virtualization team from MS created registry trick to add mounting capabilities to right click (save as .reg file and double click to import into registry):
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD\shell] @="Mount" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD\shell\Dismount] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD\shell\Dismount\command] @="\"C:\Program Files\Microsoft Virtual Server\Vhdmount\vhdmount.exe\" /u \"%1\"" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD\shell\Mount] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD\shell\Mount\command] @="\"C:\Program Files\Microsoft Virtual Server\Vhdmount\vhdmount.exe\" /p \"%1\"" [HKEY_CLASSES_ROOT\.vhd] @="Virtual.Machine.HD"
Now you can doublelick to mount vhd file or right click on iz to dismount it. There are known problems with Vista (regarding UAC), because you need administrative privileges to mount vhd file. You ca neither disable UAC (not recommended) or set up vhdmount.exe to always run with elevated privileges.
If you do not need full Virtual Server instalation, you can select “Custom” during instalation procedure and clear all components except VHDMount.
Of course, now when I was able to mount vhd file (created by Vista Backup), I could easily copy all my document and other files to Windows 7 installation.