• No results found

Creating a virtual machine

After installing Hyper-V and configuring Hyper-V Manager, you are ready to create VMs and install the OS on each one. By using Hyper-V Manager, you can create new VMs and define the hardware resources that the system should allocate to them. In the settings for a particu- lar VM, depending on the physical hardware available in the computer and the limitations of the guest OS, administrators can specify the number of processors and the amount of memory a VM should use, install virtual network adapters, and create virtual disks by using a variety of technologies, including storage area networks (SANs).

By default, Hyper-V stores the files that make up VMs in the folders you specified on the Default Stores page during the installation. Each VM uses the following files:

■ A virtual machine configuration file in XML format with a .xml extension that contains

the VM configuration information, including all settings for the VM.

■ One or more VHD (.vhd or .vhdx) files to store the guest OS, applications, and data

for the VM.

In addition, a VM can use a saved-state (.vsv) file if the machine has been placed into a saved state.

To create a new VM, use the following procedure.

1. Log on to the server running Windows Server 2012 using an account with administra- tive privileges. The Server Manager window opens.

2. From the Tools menu, select Hyper-V Manager to open the Hyper-V Manager console.

3. In the left pane, select a Hyper-V server.

4. From the Action menu, select New > Virtual Machine. The New Virtual Machine Wizard starts, displaying the Before You Begin page.

5. Click Next to open the Specify Name And Location page.

6. In the Name text box, type a name for the VM, keeping in mind that the system will also use this name to create the VM files and folders. To create the VM files in a location other than the default, select the Store The Virtual Machine In A Different Location check box and type an alternate path in the Location text box. Then click Next. The Assign Memory page opens.

MORE INFORMATION MEMORY

For more information on how Hyper-V uses memory, see the section “Allocating memory” later in this chapter.

7. In the Startup Memory text box, type the amount of memory you want the VM to use and click Next. The Configure Networking page opens, as shown in Figure 3-8.

Objective 3.1: Create and configure virtual machine settings CHAPTER 3 139

FIGURE 3-8 The Configure Networking page of the New Virtual Machine Wizard.

8. From the Connection drop-down list, select a virtual switch and click Next. The Connect Virtual Hard Disk page opens, as shown in Figure 3-9.

MORE INFORMATION NETWORKS

For more information on virtual switches and networking VMs, see Objective 3.3, “Cre- ate and configure virtual networks,” later in this chapter.

9. Leave the Create A Virtual Hard Disk option selected and type values for the following fields:

Name Specifies the file name for the VHD, using the .vhdx format new to

Windows Server 2012

Location Specifies a location for the VHD other than the default you specified on

the Default Stores page

Size Specifies the maximum size of the VHD

MORE INFORMATION STORAGE

By default, the wizard creates a VHD file that starts small and dynamically expands up to the maximum size you specify. For more information on Hyper-V storage, see Objec- tive 3.2, “Create and configure virtual machine storage,” later in this chapter.

10. Click Next. The Installation Options page opens.

11. Leave the Install An Operating System Later Option selected and click Next. The Completing The New Virtual Machine Wizard page opens.

12. Click Finish. The wizard creates the new VM and adds it to the list of VMs in Hyper-V Manager.

The VM that this procedure creates is the equivalent of a bare-metal computer. It has all the (virtual) hardware it needs to run, but it has no software.

NOTE USING WINDOWS POWERSHELL

To create a new VM by using Windows PowerShell, you use the New-VM cmdlet with the following basic syntax:

New-VM –Name “VM name” –MemoryStartupBytes <memory> –NewVHDSizeBytes <disk size>

For example, the following command would create a new VM called ServerA with 1 GB of memory and a new 60-GB VHD drive:

New-VM –Name “ServerA” –MemoryStartupBytes 1GB –NewVHDSizeBytes 60GB

There are, of course, many more parameters for the New-VM cmdlet, which you can explore through the Get-Help cmdlet.

Objective 3.1: Create and configure virtual machine settings CHAPTER 3 141

Each VM on a Hyper-V server consists of a collection of settings that specify the hardware resources in the machine and the configuration settings that control those resources. You can manage and modify those settings by using the Settings page for the particular VM.

Selecting a VM from the list in Hyper-V Manager displays a series of icons in the Actions pane. Clicking the Settings icon opens the Settings dialog box, shown in Figure 3-10, which is the primary configuration interface for that VM. Here, you can modify any of the settings that the New Virtual Machine Wizard configured for you.

FIGURE 3-10 The Settings dialog box for a VM.