Solution: There are many reasons to create virtual drives. And you can do so before creating a virtual server or system when you have Hyper-V installed and can access the Hyper-V Manager.
Virtual Hard Drives
You can create virtual drives when you create your virtual machines, or you can instead create them first. One reason for doing so may be to move data that is on a physical drive you are trying to consolidate into a virtual disk.
You have a few options when creating a virtual hard drive:
- Dynamically expanding disks: The virtual machine utilizes only the physical disk it is actually using. When more disk space is needed, the space used on the physical disk expands up to the defined amount of disk for the virtual machine. For example, if you configure the virtual machine with a 100GB drive, and only 25GB is being used, only 25GB of physical disk is used until the virtual machine needs more, up to 100GB. This type of disk is useful if performance is not a top priority, such as when building development or test servers.
- Fixed-size disks: The virtual machine utilizes the full amount of physical disk assigned to it, whether it is being used or not. With this type of disk, if the virtual machine is assigned 100GB and is using only 25GB, it would still utilize the full 100GB of physical disk. Fixed-size disks are typically used for production virtual machines where high performance is needed.
- Pass-through disks: A pass-through disk utilizes external storage without the use of a virtual hard disk. The virtual machine writes directly to the external storage. Some compatible data sources are physical disks, partitions, and LUNs.
- Differencing disks: You can use a differencing disk if you are going to make a change to a virtual machine and want to have the option to roll back to the virtual machine before the changes are made, if needed. With a differencing disk, all changes are logged on this disk, and the original virtual hard drive is left intact. Therefore, if you need to roll back to a state before the changes, you can remove the differencing disk, and the original, untouched, disk will be used. Snapshots take advantage of this technology. A snapshot is a point-in-time copy of the virtual machine that creates a differencing disk with the file extension .avhd.
NOTE: Configuring pass-through disks take extra work. This configuration is addressed by the Server Setup/Core Team at http://blogs.technet.com/askcore/ archive/2008/10/24/configuring-pass-through-disks-in-hyper-v.aspx.
To configure these different types of disk, you use the Virtual Hard Disk Wizard. Let's configure a new dynamically expanding virtual disk:
- Open Hyper-V Manager through Server Manager or from your server's Administrative Tools.
- In the Actions pane, select New, Hard Disk.
- On the Before You Begin screen, click Next.
- The Choose Disk Type screen (shown in Figure 7.3) asks you what type of virtual hard disk you want to create (for example, dynamically expanding, fixed size, differencing). Choose one and click Next.
- On the Specify Name and Location screen, provide a name and the location for the .vhd file. You can click Browse to select a new location if the default doesn't suit your needs.
- On the Configure Disk screen, determine the size you require. You will be shown a default size under Create a New Blank Virtual Hard Disk and the maximum you can create. You can also choose Copy the Contents of the Specified Physical Disk if you want to use a physical disk and move the contents to the virtual drive. Make your choice and click Next or Finish.
- On the Summary screen, confirm your choices and click Finish.
The Choose Disk Type screen.
When the disks are created, you can change or work with the disks by clicking the Edit Disk option from the Actions pane. (Note that below that option is the Inspect Disk option.) A wizard appears, and you can choose different options, depending on the type of disk you are editing. First, you need to locate the virtual hard drive, and then you can choose an action. You may be able to perform the following, depending on the disk type:
Create Virtual Machines
Now that you have created the virtual disk, you are ready to build your first virtual machine. You can use the New Virtual Machine Wizard in Hyper-V Manager. To access this wizard, open the Hyper-V Manager and perform the following:
- From the Actions pane select New, Virtual Machine.
- On the Before You Begin screen, read the notes about the wizard and then click Next.
- On the Specify Name and Location screen, provide a name for the virtual machine and then either leave the location set to the default or select the Store the Virtual Machine in a Different Location checkbox and choose a new location. Then click Next.
- On the Assign Memory screen, determine the appropriate amount of memory to use. Memory is a key factor for virtual systems, which is why you need as much as possible in a system where you plan on adding many virtual machines. When you're done, click Next.
- On the Configure Networking screen, choose the network adapter that you want to use for that virtual machine. Then click Next.
- On the Connect Virtual Hard Disk screen, create a virtual hard disk at this time (as shown in Figure 7.4) or choose to use an existing virtual hard disk that you may have already created (as you did earlier in this chapter). You can choose Attach a Virtual Hard Disk Later as well. Make your choices and click Next.
- On the Installation Options screen (shown in Figure 7.5), choose one of the following:
NOTE: The location for your virtual machines is set by default under the Hyper-V Server Settings, on the Actions pane.
- Install an OS later.
- Install an OS from a boot CD/DVD-ROM (which allows you to choose the media as a physical drive or an ISO file).
- Install an OS from a boot floppy disk (for a virtual floppy disk, or .vfd file).
- Install an OS from a network-based installation server.
When you're done, click Next or Finish.
The Connect Virtual Hard Disk options.
The Installation Options screen.
NOTE: Microsoft with Hyper-V supports a number of different guest operating systems. The list at the following site includes mostly Microsoft operating systems and various flavors of SUSE Linux: www.microsoft.com/windowsserver2008/en/us/ hyperv-supported-guest-os.aspx. This isn't to say other operating systems will not work; they just aren't supported -- so they might or they might not work.
Work with the Virtual Machine Connection Tool
You may have worked with a virtual machine tool in the past -- maybe VMware or perhaps Virtual PC. If so, you'll find the Virtual Machine Connection tool a very simple tool to work with. If you haven't worked with such a tool, you need to learn a few concepts so that you can work with your virtual machines.
Note in Figure 7.6 that there are menus across the top of the Virtual Machine Connection tool, and there are little buttons as well. The buttons allow you to perform the same tasks that you see from the Action menu. You can use Ctrl+Alt+Delete, Turn Off, Shut Down, Save, Pause, Reset, Snapshot, Revert, and Insert Integration Services Setup Disk (which we discuss in the next section).
The Virtual Machine Connection tool.
NOTE: If you click in the virtual machine, your mouse initially stays in the window until you press Ctrl+Alt+left arrow. So don't panic; just click those keys to release your mouse.
For the most part, if you click within the Virtual Machine Connection tool, you are working with your OS the same as you would if it were a real server. We therefore don't need to discuss those options further. However, note that you can make changes to the settings of your virtual machine in a much faster manner by selecting File, Settings.
One of the benefits of running a virtual machine is the ability to reconfigure the virtual hardware for the virtual machine. These are some of the items you can adjust:
- BIOS settings
- Processor settings
- Memory allocation
- IDE controller settings (add hard drive, CD/DVD drive)
- Addition and removal of network interface cards (NIC)
The settings for your virtual machine appear in an easy-to-select and easy-to-configure structure, as shown in Figure 7.7. You'll find that many of the settings you might want to configure, such as the amount of RAM assigned to the virtual machine, cannot be configured while the virtual machine is running. You need to power down the OS to make the adjustment. All in all, though, it is still a very fast adjustment to make compared to opening a system and literally having to place new RAM inside it. Now you simply allocate more RAM and turn the virtual machine back on.
Virtual machine settings.
You should also note that there are some icons in the bottom-right corner of the Virtual Machine Connection tool that show you your input methods and security level.
NOTE: Hyper-V includes the ability to take snapshots of your virtual machines. By doing so, you create a point-in-time image of that system that you can restore at any time in the future to revert to that time. These snapshots can be taken at any time, while the system is running or stopped. This is an excellent way to recover your system in the event that you install something or make a change that is devastating. You simply create the snapshot, make your mistake (if it is a mistake), and restore the snapshot.
As you can see in Figure 7.8, you can use the Hyper-V Manager to monitor and manage your Hyper-V servers, the virtual machines they contain, and the snapshots of those virtual machines.
Install Integration Services
When your OS is installed in the virtual machine, you might want to install Integrated Services to provide a smoother experience in working with the virtualized OS. This is common in other virtualization solutions.
Integration Services installs drivers and services that allow your virtual machines to have a more consistent state and improve performance. Some of the benefits include the following:
- Improved desktop experience on the guest, via mouse pointer integration
- Time synch to keep guest OS time in synch with host OS time
- Access to the VMBus
- Use of synthetic devices
- Automation of start and stop processes
- VSS integration for live backup of running virtual machines
NOTE: The difference between a synthetic device and an emulated device has to do with how a virtual guest accesses the device. With synthetic devices, a request is packaged and forwarded to the host OS, over the VMBus, which in turn forwards the request to the needed physical device. Emulated devices emulate the physical hardware; for example, each virtual machine runs the emulation process vmwp.exe.
To install Integration Services, perform the following steps:
- In the Virtual Machine Connection tool, select Action, Insert Integration Services Setup Disk.
- The AutoPlay dialog appears because typically the system now views the Integration Services application as a DVD drive for you to install or run. Click the link to Install Hyper-V Integration Services.
- When you are asked to restart your system, click Yes to restart immediately or No to wait until a later time.
Installing and managing Hyper-V on Windows Server 2008 Server Core
Using Hyper-V Manager to create virtual machines and hard drives
Monitoring Hyper-V performance and utilizing System Center VMM
Printed with permission from Sams Publishing. Copyright 2009. Windows Server 2008 How-To by J. Peter Bruzzese, Ronald Barrett and Wayne Dipchan. For more information about this title and other similar books, please visit Sams Publishing.
This was first published in November 2009