Hello and welcome to your free training course for Windows 7. In this video I will look at
virtual hard disks. In the previous videos I touched on the virtual hard disks as a solution
for dual booting. In this video I will explorer virtual hard disks in more detail.
Virtual hard disk are used in virtualization solutions like Hyper V and virtual PC. A virtual
hard disk is contained in a single file. Because of this, it is easy to move a virtual hard
disk from one computer to anther computer. You can even move a virtual file between a
virtual PC solution such as Hyper V to a physical computer.
If you want to make changes to a virtual hard disk. The virtual hard disk can be mounted
under the operating system allowing you to make changes to the file.
As shown in previously, virtual files are great choice for dual booting. Once you are
done with the file, remove it afterwards. No need to re partition your hard disk. In
order to boot from a virtual hard disk or VHD file you require Windows 7 enterprise
or ultimate edition. In order to understand virtual hard disks better, I will install
Windows 7 on a brand new computer and configure it to boot from a virtual hard disk.
On my Windows 7 computer, I have already booted it from the Windows 7 DVD. From the start
screen I will accept the defaults. Select install windows and then select the edition
of windows and accept the license agreement and lastly select custom advanced to install
a fresh copy of Windows 7. So far the procedure has been exactly the
same as if I was performing a clean install of Windows 7. This computer has one hard disk
which has not been formatted yet. Before I can create the VHD file I need some where
to store it. If I select the option drive options advanced, I can then select the option
new to format the hard disk. In this case I want to use all the free space
on the hard disk in one partition so I will select apply which will by default use all
the available hard disk space. The setup program will give you a message saying that some space
will be reserved for a system partition. This is normal, and when I press ok you will see
that two partitions have been created. One system partition and one partition for my
operating system and files. The next thing I need to do is format the
hard disk, when I select the option format I will get a warning saying that any data
on the hard disk will be lost. I can't create the virtual hard disk using setup. To create
the hard disk I need to use the command line tool disk part. To run disk part, press shift
F10 to open a command prompt and then type in disk part.
From disk part, run the command create vdisk followed by file equals and the filename of
the vhd file. In this case, windows has given the newly created disk the drive letter of
e. This will change when the system boots up. If you are not sure which drive letter
is being used, run the command list volume. Next I need to enter in the size of the hard
disk, in this case I will make it 60 gigabytes. By default the type will be fixed which you
can set with option type equals fixed. The fixed option means that the hard disk space
will be allocated immediate or in other words, a 60 gigabyte file will be created. This gives
you better performance. Microsoft recommended that you use the fixed disk type in production
systems.
The next type is expandable also referred to as dynamic. When you use this type of virtual
hard disk, the file expands as more data is written to the hard disk. This means your
virtual hard disk file is proportional to the amount data stored on the virtual hard
disk. The advantage of this is that your virtual hard disk is smaller but the performance of
the virtual hard is slower when compared with a fixed virtual hard disk. For this reason,
Microsoft recommend that expandable virtual hard disks are not used on a production system.
The hard disk has been created, but before I can start using it needs to be attached
to the system. To do this, I first need to select the hard disk using the select vdisk
command followed by the file name of the virtual disk.
Once selected, I then need to run the command attach vdisk. Now that the virtual hard disk
is attached to the system, I can now exit disk part and the command prompt and returned
back to windows setup. Once I select the option refresh my virtual hard disk will appear and
I can select it and install Windows 7 on it. You will notice a warning at the bottom of
the screen. If I open the warning you can see a message stating that windows can't be
install on this disk because the bios may not support it. Assuming your bios supports
this kind of booting you should be right to install windows and you can ignore this message.
Windows 7 will now install. I will pause the video and return once Windows 7 has finished
installing and I have logged in. This computer now has only one operating system
installed on it and that operating system is running on a virtual hard disk file. If
I open windows explorer and open the d drive up, you can see the virtual hard disk file.
One file contains all the operating system files and user data for this computer. If
I open the c drive up you can see that the c drive looks just like a normal Windows 7
install. The only difference is that the data from the hard disk is being stored on the
d drive on a virtual hard disk. If I open up computer management and go into
disk management, in disk management you can see the virtual disk has appear in blue. If
I right click on disk management I have the option to create additional virtual disks
and also to attach a virtual disk. Attaching a virtual hard disk is one way that you can
perform maintenance on a hard disk. For example, attaching a virtual hard disk to your system
would allow you to add and remove files from the virtual hard disk.
If I run a command prompt with administrator privileges. I can run the command BCDEdit
with the switch slash v. Here you can see that the virtual hard disk has been added
to the boot menu and that it is the only operating system on this computer.
If you created a standard VHD file, you could deploy it to many computers in your enterprise.
Once completed you could in the future perform maintenance on the file.
Unlikely WIM files, there are not too many ways to perform maintenance on your VHD files.
To perform maintenance you can download the offline Machines servicing tool from the Microsoft
web site. Even though this is a free download, it does require System Center Virtual Machine
Manager to be installed on your system which is a commercial product available from Microsoft.
Otherwise you can always make changes by mounting the virtual hard disk under windows explorer.
If you already have a Windows 7 computer in WIM format and want to deploy it to a VHD
file you have a few options. Firstly you can deploy the image to a virtual hard disk using
ImageX. To use ImageX with a virtual hard disk, simply
attach or mount the virtual hard disk and then run then run ImageX with the switch
apply. In our previous video I when through the whole process with a physical hard disk.
If you follow this procedure adding the step to attach the virtual hard disk you can use
ImageX deploy an image onto a virtual hard disk.
If you have an existing WIM file and want to convert it into a VHD file, Microsoft offers
a free tool available for download from their web site. The tool requires Windows Automated
Installation Kit to be installed. Another free download from the Microsoft web site.
To demonstrate how to use the WIM2vhd script, I will change to my computer running Windows
7 with windows AIK installed. First of all, I need to open internet explorer and perform
a search for WIM2vhd. This will give me the MSDN web site that contains the script.
Once I open the web site, all I need to do is select downloads and down the script to
my local computer. The download is only a script, there is no installer for the file.
Once download, I next need to open a command prompt with administrator privileges to run
the script. Once I change directory to run the script,
I can run cscript followed by the name of the script. Cscript is software that runs
a number of different kinds of scripts. For example, it can also run VB script files as
well as others, in this case the script is a windows script file.
I need to also enter in some parameters. The first is slash WIM followed by colon and then
the path to the WIM image. In this case I will use the install.WIM file on the Windows
7 DVD. Next I need to enter in slash vhd colon and the name of the output vhd file. Finally,
since this WIM files contains multiple images, I need to enter in slash SKU colon and then
the reference number for the image that I want to use. In this case I will use the first
image. The script will now run and the original WIM
file is converted to a vhd file. This is the last video on imaging and installing windows.
There is a lot to imaging in windows, but if done correctly will save you a lot of time
in enterprise environments. In the next video I will look at using device drivers for windows.