Windows 7: VHD capabilities paired with built-in Backup

2009 January 11
by Acer

One of my favorite features of Windows 7 so far is the ability to create, attach, and otherwise use VHD (Microsoft’s format for Virtual Hard Disks, used in Virtual PC, Virtual Server, Hyper-V, and now Windows 7 apparently) files. Why would you want to do this? Well, a few reasons. First of all, Microsoft distributes certain things as VHD images, primarily at tradeshows and conferences, and the ability to natively mount them inside of Windows 7 is fantastic.

Windows 7 also allows you to mess about with your Boot menu and gives you the ability to set a VHD as your boot device. This is a slick thing, especially for testing various things you don’t necessarily want to keep around. They get away with this by installing a loopback type of storage adapter that allows a file on the drive to be referenced as if it were it’s own partition.

One of the things that I’ve been messing with is using this feature in conjunction with Windows 7′s native backup utility. The backup software included with Windows stores image backups in the VHD format, which means you can now mount an image that you previously backed up and grab files from it (something that the image backup does not let you do by default).

The first thing you’ll need to do to accomplish this is to take a backup. Open up the Backup and Restore application.

(Hint: click on any image for a full size screenshot)

backup

The first thing it will ask you is where you want to store your image backup. It suggests an external drive, and you’ll certainly want to store your backups on a separate disk if possible. Also bear in mind you’ll need enough space available to do an image backup of your system partition.

backuplocation

At the next screen, you’ll select what you want to backup. Select whatever is appropriate for your configuration, but it’s always a good move to make sure you check the “Include a system image” at the bottom, as this will be what takes a VHD image of your system drive.

backupselections

You’ll then see a review of the settings you’ve chosen, and have the option to edit the schedule, make it an on-demand backup, etc.

backupreview

After your backup has finished processing, we’re ready to move on to the next phase: attaching the VHD file it created and rescuing some files.

The VHD will be stored in a folder structure on the drive you selected to place your backups onto. You’ll see a folder called WindowsImageBackup. Inside of that, there will be a folder with the name of your Computer. Within that folder, you’ll see various folders (depending on how many backups you’ve taken) that are named with the prefix “Backup” and followed by a date.
(Hint: You will need to allow yourself access to these folders the first time you try this, by default the Backup application does not give access to users. Just doubleclick on the folder to open it like normal, and when prompted to give yourself access, do so.)

backupdirectory

Open up the folder you want, and locate the VHD file. It will be a long hex name, and the only file in the directory that isn’t an XML file.

backupvhdlocation

Now, right click on the VHD file and choose properties. Once their, go to the security tab and assign your user Full control; this will be needed to mount the drive image. We’ll still mount it as read-only to prevent anything bad from happening, but we need this step to get it mounted in the first place.

backupvhdsecurity

Now that we’ve gotten that taken care of, it’s time to get into the Disk Management tool and attach the VHD. Open up Computer Management in your preferred fashion; I usually just right click on “Computer” from the Start Menu and choose “Manage”.

Once you’ve got it open, drill down into the “Storage” section and select Disk Management. This will take a few seconds as it attaches to the Service and scans the drives. After it’s done and your info appears, right click on “Disk Management” and select “Attach VHD”.

attachvhd

This will bring up a dialog box, click Browse, and select the VHD file from your backup location. Click the “Read-only” box unless you plan to write to the volume, which will very possibly screw up your ability to restore through the built-in interface. When in doubt, just make sure that box is checked.

attachvhddialog

When this process is complete, you should see the new disk. It will have the same name as the volume you backed up, but will have a different drive letter, and the disk icon will also have a blue hue to it to denote that it is a VHD and not a physical disk.

diskmanagervhd

diskmanagerdetails

At this point, you can use Windows Explorer to browse into the VHD just like a normal drive. Go grab whatever you needed and copy it over. Note the highlight in the Address Bar in the second screenshot denoting that the source is the L:\ drive, not the C:\ drive.

explorerdisks
restorephoto

Once you’ve retrieved everything you need from the disk, you can jump back into Disk Management to detach the VHD. When you do this, you’ll have an option to Delete the VHD file as you detach it. You’ll want to make absolutely sure that you have this box unchecked, unless you know for sure that you no longer want that particular VHD around.

detachvhd

detachvhddonotdelete

And that’s it! You’ve successfully mounted a VHD backup file. The VHD capabilities can be used for many, many other things as well, in fact, if you want to get fancy with it, you could actually set one of these VHD files to boot from. I could take a VHD image backup of my machine, and basically use it as a test environment by booting from it, making any changes I wanted to test with, while leaving my production machine untouched.

Feel free to leave comments/questions! I’ll be going over other features of Windows 7 as I get time to play around with them!

Post to Twitter Post to Facebook Post to Reddit Post to Digg Post to StumbleUpon

8 Responses leave one →
  1. Matt Ford permalink
    January 21, 2009

    So basically it’s MS’s answer to Time Machine?

  2. January 27, 2009

    Great! Thank you!
    I always wanted to write in my blog something like that. Can I take part of your post to my blog?
    Of course, I will add backlink?

    Regards, Timur Alhimenkov

  3. Acer permalink*
    January 28, 2009

    I suppose it could be used that way…sort of. It’s not near as elegant, easy, or frankly useful in that manner, in my opinion. While you CAN do very powerful things with this, I don’t think you can expect a normal user to do them, which kind of invalidates a direct comparison to Time Machine. Now, the Windows Backup program itself is certainly more refined than in years past, and more user friendly (read: Wizard-driven), but Time Machine is still a better option in my opinion. A better feature to compare Time Machine to would be the Shadow Copies in Windows which lets you restore files to earlier times by using the “Previous Versions” tab of the properties of the file or folder.

  4. Acer permalink*
    January 28, 2009

    Sure, feel free to reproduce/backlink. I don’t speak Russian or do marketing, so I need someone over there to get the word out!

  5. February 1, 2009

    Matt,
    Time Machine was Apple’s answer to microsoft’s shadow copy. Microsoft didn’t do much marketing about it which is a mistake because it was a great feature, but shadow copy has existed for a long long time.

  6. Alexwebmaster permalink
    March 3, 2009

    Hello webmaster
    I would like to share with you a link to your site
    write me here preonrelt@mail.ru

  7. Richard Reukema permalink
    May 27, 2009

    I have WindowsImageBack VHD that I created with Vista X64. I am able to attach it with my WIN7, which seems to work fine. After I attach the VHD however, the drive status is ‘unallocated’.

    All I am trying to do is restore some files from it – is there an easy way to do this? I think this was a Windows Image as opposed to a windows backup. Do I have to restore the whole image? I don’t have the computer anymore, so will another one do?

  8. Luke permalink
    September 11, 2009

    @Richard:
    Don’t check the “read-only” checkbox. Then it will work.

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS