Restore data from Vista full computer backup to Windows 7

by Marin Franković on 24 February, 2009

VHDmount.exe CLIThe 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.

Examples:
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.


{ 10 comments… read them below or add one }

1 Srivats 18 April, 2009 at 17:24

Thank’s for the Wonderfull information..

Reply

2 Scorp 27 May, 2009 at 21:01

Cool information, but Windows 7 has bult-in VHD file mount support…
Via Disk Management!
This is fundamental on earlier Windows verisons!

Reply

3 Marin 27 May, 2009 at 23:51

True. Windows 7 has the ability to create and mount vhd files through Disk Management console.

Reply

4 Jm 23 July, 2009 at 12:49

I’ve installed Windows 7 on my laptop now. I want to restore some files from my previous backup of Windows Vista Business in “vhd” format. It’s a Complete PC Backup, i just wana copy some important files from it. The Disk management procedure is giving error “file system limitation”and i cant Attach VHD. I’ve also downloaded and installed Microsoft Virtual PC, but dont dont know how to mount the backup file with it. Also, just wana tell you that i’ve made a Complete PC Backup on several DVD’s, about 5 i guess. I didnt had a usb with enough space at that time.
Can anyone help me retrieve files from my backup????

Reply

5 Marin Franković 23 July, 2009 at 12:57

Maybe this is your problem: “You can only attach a VHD that is located on an NTFS volume.”. DVD uses UDF and not NTFS. Try to copy vhd files to NTFS drive or to SMB shared disk. More can be found here: http://technet.microsoft.com/en-us/library/dd440865%28WS.10%29.aspx

Reply

6 dp 6 September, 2009 at 16:33

this may help you out as well. I am testing out some features and ran across this and it came in very handy for me. You can mount the VHD from within the disk management console.

Reply

7 John 5 November, 2009 at 16:59

Thank you guys for the great know-how!

Reply

8 sofrata 2 February, 2010 at 5:56

is it possible to restore applications from vista when i upgrade to windows7? and how?

Reply

9 Marin Franković 2 February, 2010 at 8:02

Hi,

my recommendation would be to run Windows 7 Upgrade Advisor to test all drivers, hardware and applications for compatibility before you install Windows 7. There are no Microsoft applications that will restore your custom installations from Vista backup to Windows 7 installation. Best way is to reinstall applications in Windows 7.

Reply

10 Chris 10 March, 2010 at 4:24

Wow, you guys are way over my head on this. Simply put….I don’t know what the crap you are talking about. I too backed up my laptop when switching from Vista to 7. I backed it up onto an old pc hard drive. Now when I need to get all of my outlook files and emails onto the new system I am f’d and I have no idea what all of what you guys are tlkaing about. I am not a computer guru. I just need my shit back asap… can anyone explain to me how to do this in English please…….

Reply

Leave a Comment

Previous post:

Next post: