DESKTOP

Windows Server 2008 : Create Virtual Hard Drives and Machines

 
10/12/2010 3:50:30 PM
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.

    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.


  • 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.

To configure these different types of disk, you use the Virtual Hard Disk Wizard. Let’s configure a new dynamically expanding virtual disk:

1.
Open Hyper-V Manager through Server Manager or from your server’s Administrative Tools.

2.
In the Actions pane, select New, Hard Disk.

3.
On the Before You Begin screen, click Next.

4.
The Choose Disk Type screen (shown in Figure 1) asks you what type of virtual hard disk you want to create (for example, dynamically expanding, fixed size, differencing). Choose one and click Next.

Figure 1. The Choose Disk Type screen.


5.
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.

6.
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.

7.
On the Summary screen, confirm your choices and click Finish.

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:

  • Compact: This option allows you to shrink the disk size on a dynamically expanding disk, removing any empty spaces left behind when data was deleted.

  • Convert: This option allows you to change a fixed disk to a dynamically expanding disk and vice versa.

  • Expand: This option increases the size of either a fixed disk or a dynamically expanding disk.

  • Merge: This option merges a differencing disk to the original parent disk.

  • Reconnect: If you have chosen to use a differencing disk and the parent disk cannot be found, you are automatically asked to reconnect.

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:

1.
From the Actions pane select New, Virtual Machine.

2.
On the Before You Begin screen, read the notes about the wizard and then click Next.

3.
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.

Note

The location for your virtual machines is set by default under the Hyper-V Server Settings, on the Actions pane.

4.
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.

5.
On the Configure Networking screen, choose the network adapter that you want to use for that virtual machine. Then click Next.

6.
On the Connect Virtual Hard Disk screen, create a virtual hard disk at this time (as shown in Figure 2) 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.

Figure 2. The Connect Virtual Hard Disk options.


7.
On the Installation Options screen (shown in Figure 3), choose one of the following:

  • 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.

Figure 3. The Installation Options screen.


When you’re done, click Next or Finish.

8.
On the Summary screen, look over your chosen options and then click Finish or the checkbox Start the Virtual Machine After It Is Created and then click Finish.

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 4 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).

Figure 4. 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 5. 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.

Figure 5. 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 6, 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.

Figure 6. Hyper-V Manager.


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:

1.
In the Virtual Machine Connection tool, select Action, Insert Integration Services Setup Disk.

2.
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.

3.
When you are asked to restart your system, click Yes to restart immediately or No to wait until a later time.

Other  
  •  Windows Server 2008 : Manage Hyper-V Remotely
  •  Windows Server 2008 : Install the Hyper-V Role
  •  Windows 7 : Rolling Back to a Stable State with System Restore
  •  Windows 7 : Configuring System Protection Options
  •  Windows 7 : Using the Windows Backup Program
  •  Active Directory Federation Services (ADFS)
  •  Active Directory Rights Management Service (RMS)
  •  Active Directory Lightweight Directory Service (LDS)
  •  Windows Server 2003 : Securing and Troubleshooting Authentication
  •  Windows Server 2003 : Managing User Profiles
  •  Windows Server 2003 : Creating Multiple User Objects
  •  Windows Server 2003 : Creating and Managing User Objects
  •  Understanding Application Domains
  •  Building and Deploying Applications for Windows Azure : Activating the Storage Account Account
  •  Deploying Applications to Windows Azure
  •  Building and Deploying Applications for Windows Azure : Creating a Demo Project
  •  Network Programming with Windows Sockets : Datagrams
  •  Network Programming with Windows Sockets : An Alternative Thread-Safe DLL Strategy
  •  Network Programming with Windows Sockets : A Thread-Safe DLL for Socket Messages
  •  Network Programming with Windows Sockets : In-Process Servers
  •  
    Top 20
    The Language of Apple Platforms : Objective-C Programming Basics
    Send an Email via SMTP
    Search for a File or Directory
    Algorithms for Compiler Design: THE NFA WITH ∈-MOVES TO THE DFA
    SQL Server 2008 Command-Line Utilities : The bcp Command-Line Utility
    Becoming an Excel Programmer : Start and Stop
    The ASP.NET AJAX Infrastructure : The Script Manager Control
    Managing Connection and Proxy Settings
    Silverlight : Make Your Application Run out of the Browser
    Configuring Networking for Laptops
    Infrastructure Security: The Network Level
    Hacking - Advanced Camouflage
    Visual Design of Workflows with WCF and WF 4
    Permissions: Extending the .NET Framework
    WCF Services : Data Contract - Hierarchy
    Tools to Manage Access Control Lists
    Supporting Computers Running Windows Vista
    Parallel Programming with Microsoft .Net : Pipelines - Variations
    Managing the Cache
    Communicate over the Internet (WCF)