Virtualization Part 3: Windows VHD
We have covered a series of virtualization products but I wanted to bring this one up because, it comes with Windows and is a different look at virtualization. Windows 7 introduced a feature called “Boot to VHD” and we will cover how to do just that.
VHD is Microsoft virtual hard disk format. See Virtualization Part 2 for the different formats that the different vendors use. While this is not virtualization like VMware or VirtualBox where the virtualization sits on top of the OS. In this case you are going to create just a virtual disk and install an OS into that while using ALL your physical hardware. It looks a little like this:
A physical computer with multiple virtual hard drives on it. Each OS is separate from each other and uses the full hardware of your PC.
Why do this you ask. Well it lets you have dedicated environments for different scenarios you might for need, for instance, you want to test different virtualization technologies but don’t want them conflicting on your PC so you create two vhd’s boot your OS to both of them and install either solution without worry of corrupting or conflicting with each other.
For this exercise you are going to need a couple of things:
· The USB drive you have your Windows 7 install on it
· Enough hard drive space in your computer.
All the drivers from your manufacture just in case Windows does not detect all your hardware. Remember this may be a virtual hard disk but it will use all your physical hardware.
Let’s get started.
Print this post so you can use it as reference when you turn your computer off. While I don’t promote the over use of paper it’s hard to do this without actually looking at directions.
Power off your pc
Plug in your USB drive with Windows 7 installer on it, refer to my second post if you don’t have this done.
Power on your laptop and hit whatever key you need to get to your boot menu and select from your USB drive and boot your PC.
When your computer is booted and you’re looking at the Windows 7 installation screen press Shift+F10 to open the command prompt
In diskpart, type list volume. You want to find the volume that is your hard drive. **Note** it may not be what your used to seeing, i.e. in Windows it’s the “C” drive but in diskpart it could be “D” drive.
Type the following Create vdisk file=d:\Windows7.vhd maximum=40960
This command will create a .vhd file on your computers C drive that is 40GB in size. Remember 1GB = 1024 MB so 40960 = 40Gb. You can make this file as large as you want as long as you have space on your volume. Diskpart will allocate the 40GB .vhd when you press enter.
You can also create an expandable vdisk so you can have more vdisks on your system.
Instead of the above use this command
Create vdisk file=d:\Windows7.vhd maximum=40960 type=expandable
This will create a .vhd with little size and will expand up to a 40GB size.
I use expandable vdisks to maximize my storage on my external disk.
Once you decide on the disk type you want to use you have to select the vdisk on the system
Select vdisk file=d:\Windows7.vhd
Now you have to attach the vdisk to the system.
Once it’s attached you can exit diskpart and exit the command prompt
Now you can continue the Windows 7 install. Click Next
Click Install Now
Accept the license agreement and terms Click Next
Select the install type, click Custom
Select the virtual disk you created and continue your install as you would normally.
The Windows installer will install just like it does just like you’re on a regular hard drive. When the computer reboots on the installs just make sure your booting into the right environment so the install will finish. Windows will edit your boot menu to have both copies of Windows 7 available at boot. To edit the boot menu you can go into diskpart again but there is an easier way to do it.
Download and install EasyBCD in any environment you want after your install is completed.
Once installed open EasyBCD is installed, launch it from the start menu.
EasyBCD will help you view, edit and add new entries for you system to boot. Play with these settings but if you want to rename an OS you installed, click Advanced
On the Select OS dropdown, pick the OS you want to change and its options appear in the window below.
As with all my posts, please command and share
Thanks for reading