Software

How do I use a Windows 7 Virtual Hard Disk as a backup device?

In this edition of the Windows Desktop Report, Greg Shultz shows you how to create and use a virtual hard disk (VHD) as a backup device.

As you know, using external hard disks as backup devices has become very popular recently due to the fact that they are now relatively inexpensive to purchase or build. I use several of them for backups on my home and test systems.

The other day I was experimenting with Windows XP Mode on my Microsoft Windows 7 test system and was backing up my Windows XP Mode virtual machine and the accompanying virtual hard disk (VHD), when it occurred to me that I could use a VHD as a backup device.

Once I began experimenting with this technique, I knew that it would be perfect complement to my overall backup strategy. I don't trust a single backup device and like to have multiple backups just in case. Using VHDs, I can easily back up my data and then just copy the VHD file to another external device.

In this edition of the Windows Desktop Report, I'll show you how to create and use a VHD as a backup device.

This blog post is also available in the PDF format in a TechRepublic Download and in a TechRepublic Photo Gallery.

Getting started

Because the technology is built right into the Windows 7 operating system, you don't have to install Windows Virtual PC to create a VHD - you can do it right from the Disk Management Console or even from the command line with the Diskpart command. Let's take a look at the procedure using the Disk Management Console. (I'll go over the Diskpart command procedure at a later time.)

To get started, click the Start button and type Diskmgmt.msc in the Start Search box and then press [Enter]. When the Disk Management Console appears, as shown in Figure A, you're ready to create your VHD.

Figure A

You can create a VHD from the Disk Management Console.

Creating a VHD

Pull down the Action menu and select the Create a VHD command. When you do, you'll see the Create and Attach Virtual Hard Disk dialog box. You'll then need to specify a location and name by clicking the Browse button. You then will specify a size. The Size drop down will allow you to select the size of the VHD in MB, GB, and, TB. As you can see in Figure B, I set up a 40GB VHD called My VH Disk in the Documents folder.

Figure B

You'll then need to specify a location, name, and size for your VHD.

You can specify the format be either Dynamically expanding or Fixed size. The latter is the default and is the option I chose for my VHD. A fixed size VHD will create a file that is the same size as the virtual disk. For example, if you create fixed VHD that is 40GB in size, the system will create a host file approximately 40GB in size.

A dynamically expanding VHD will create a file that at any given time is as large as the actual data written to it plus the size of the header and footer. For example, if you create a virtual hard disk that is 40GB in size, the system will create a host file approximately 80MB in size. As more data is written, the file dynamically increases in size by allocating more disk space from the host hard disk.

For the purposes of creating a virtual Back up device, either format is fine.

When you click OK, the Disk Management Console will begin creating the VHD. Depending on the size that you selected, it may take a little while to create the VHD. You'll see a progress gauge at the bottom of the Disk Management Console window, as shown in Figure C.

Figure C

You'll see a progress gauge at the bottom of the Disk Management Console window.
Once the VHD is created, right click on its header panel on the left side and select the Initialize Disk command and you'll see the Initialize Disk dialog box, as shown in Figure D. You'll see that your new disk is already selected and since the GPT partition style is designed for 2TB disks or Itanium-based computers, just go with the default MBR partition style and click OK.

Figure D

When you select the command you'll see the Initialize Disk dialog box.

As you may know, MBR is the standard partitioning style that's been used on hard disks since the PC first came out. (Just FYI: MBR supports a maximum partition size of 2TB. GPT supports a maximum partition size of 256TB.)

Initializing the disk is a very quick operation. Once it is complete right click on right side and select the New Simple Volume command and you'll see the New Simple Volume Wizard, as shown in Figure E.

Figure E

When you select the command and you'll see the New Simple Volume Wizard.
There are five steps in this wizard and you can just accept all the default settings and click through to the end. When you do, the disk will be formatted as an NTFS volume and an AutoPlay dialog box will appear and prompt you to open the new drive, as shown in Figure F.

Figure F

When you complete the wizard, an AutoPlay dialog box will appear and prompt you to open the new drive.

Implementing the VHD backup strategy

To back up your data to the VHD, you can simply copy the files and folders from your hard disk to the VHD or you can use Windows 7's Backup and Restore to actually create its backup file on the VHD. You can then locate the actual VHD file, as shown in Figure G, and copy it to an external hard disk or to a network drive.

Figure G

You can locate and copy your VHD file to multiple locations.

If you want to have multiple copies of your backup, you can copy the VHD file to multiple locations.

What's your take?

Will you use and incorporate VHD files into your backup strategy? Are you using VHDs for data storage? As always, if you have comments or information to share about this topic, please take a moment to drop by the TechRepublic Community Forums and let us hear from you.

Stay on top of the latest Microsoft Windows tips and tricks with TechRepublic's Windows Desktop newsletter, delivered every Monday and Thursday. Automatically sign up today!

About

Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.

Editor's Picks