Windows Server 2012 R2 Hyper-V provides several ways to create virtual disk files. You can create them as part of a VM or create them at another time and add them to a VM. The graphical interface in Hyper-V Manager provides access to most of the VHD parameters, but the Windows PowerShell cmdlets included in Windows Server 2012 R2 provide the most granular control over the disk image format.

Creating a virtual disk with a VM
The New Virtual Machine Wizard includes a Connect Virtual Hard Disk page with which you can add a single disk to your new VM. The options for this disk are relatively limited and consist of the following:
Create A Virtual Hard Disk Enables you to specify the name, location, and size of a new VHD. The wizard only allows you to create a dynamically expanding disk using the VHDX format, but you can also create fixed and differencing VHDX disks using Windows PowerShell.

Use An Existing Virtual Hard Disk Enables you to specify the location of an existing VHD or VHDX disk, which the VM will presumably use as its system disk.
Attach A Virtual Hard Disk Later Prevents the wizard from adding any virtual disks to the VM configuration. The assumption is that you will manually add a disk later, before you start the VM.
The object of this wizard page is to create the disk on which you will install the VM’s OS or to select an existing disk on which an OS is already installed. The disk the wizard creates is always a dynamically expanding one connected to IDE Controller 0 on a Generation 1 VM or connected to the SCSI Controller on a Generation 2 VM.

————–

NOTE: VHDS
It has become a common practice for Microsoft to release evaluation copies of its products as preinstalled VHD files as an alternative to the traditional installable disk images. After downloading one of these files, you can create a VM on a Hyper-V server and select the Use An Existing Virtual Hard Disk option to mount the VHD as its system drive.

————–

Creating a new virtual disk
You can create a VHD file at any time without adding it to a VM by using the New Virtual Hard Disk Wizard in Hyper-V Manager. To create a new virtual disk, use the following procedure.
1. In Server Manager, on the Tools menu, select Hyper-V Manager. The Hyper-V Manager console opens.
2. In the left pane, select a Hyper-V server.
3. From the Action menu, select New, Hard Disk to start the New Virtual Hard Disk Wizard, displaying the Before You Begin page.
4. Click Next to open the Choose Disk Format page.
5. Select one of the following disk format options:

VHD Creates an image no larger than 2 TB, using the highly compatible VHD format
VHDX Creates an image up to 64 TB, using the new VHDX format.

6. Click Next to open the Choose Disk Type page.
7. Select one of the following disk type options:

Fixed Size Creates a disk of a specific size, allocating all of the space at once.
Dynamically Expanding Creates a disk that can grow to the maximum size you specify as you add data
Differencing Creates a child drive that will contain changes made to a specified parent drive.

8. Click Next. The Specify Name And Location page opens.
9. Specify a file name for the disk image in the Name text box and, if desired, specify a location for the file other than the server default. Click Next to open the Configure Disk page.
10. For fixed and dynamically expanding disks, select and configure one of the following options:
Create A New Blank Virtual Hard Disk Specifies the size (or the maximum size) of the disk image file to create.
Copy The Contents Of The Specified Physical Disk Enables you to select one of the physical hard disks in the computer and copy its contents to the new disk image.
Copy The Contents Of The Specified Virtual Hard Disk Enables you to select an existing virtual disk file and copy its contents to the new disk image.

11. Click Next. The Completing The New Virtual Hard Disk Wizard page opens.
12. Click Finish.
The wizard creates the new image disk and saves it to the specified location.

—————————

NOTE: USING WINDOWS POWERSHELL
You can create new VHD files by using Windows PowerShell, which gives you more control than is available through the graphical interface. To create a new disk image, use the New-VHD cmdlet with the following basic syntax:
New-VHD –Path c:\filename.vhd|c:\filename.vhdx
–Fixed|-Dynamic|-Differencing –SizeBytes <size>
[-BlockSizeBytes <block size>]
[-LogicalSectorSizeBytes 512|4096] [-ParentPath <pathname>]
When using the cmdlet to create a disk image, the extension you specify for the filename determines the format (VHD or VHDX); also, you can specify the block size and the logical sector size for the image, two things you cannot do in the GUI. For example, the following command creates a 400-GB fixed VHDX image file with a logical sector size of 4 KB:
New-VHD –Path c:\diskfile.vhdx –Fixed
–SizeBytes 400GB -LogicalSectorSizeBytes 4096

————————-

Adding virtual disks to virtual machines
Creating virtual disk image files as a separate process enables administrators to exercise more control over their capabilities, but after creating the VHD or VHDX files, you must add them to a VM for them to be useful.
To add a hard disk drive to a physical computer, you must connect it to a controller; the same is true with a VM in Hyper-V. When you open the Settings dialog box for a Generation 1 VM in its default configuration, you see three controllers labeled IDE Controller 0, IDE Controller 1 and SCSI Controller. These correspond to the controllers you might find in a typical physical server computer.

Each IDE controller can support two devices and the default VM configuration uses one channel on IDE Controller 0 for the system hard disk and one channel on IDE controller 1 for the system’s DVD drive. If you did not create a virtual disk as part of the new Virtual Machine Wizard—that is, if you chose the Attach A Virtual Hard Disk Later option—then you must add a hard disk image to IDE Controller 0 to use as a system drive. A Generation 1 VM cannot boot from the SCSI controller.
To add an existing virtual system drive to a VM, use the following procedure.

1. In Server Manager, on the Tools menu, select Hyper-V Manager to open the Hyper-V Manager console.
2. In the left pane, select a Hyper-V server.
3. Select a VM and, in the Actions pane, select Settings. The Settings dialog box for the VM appears.
4. Select IDE Controller 0, as shown in Figure 3-16.

Creating virtual disks

FIGURE 3-16 The IDE Controller interface in the Settings dialog box

5. In the IDE Controller box, select Hard Drive and click Add. The Hard Drive page opens, as shown in Figure 3-17.

Creating virtual disks

FIGURE 3-17 The Hard Drive interface in the Settings dialog box

6. In the Controller drop-down and the Location drop-down, select the IDE controller and the channel you want to use for the hard disk.
7. With the Virtual Hard Disk option selected, click Browse and select the disk image file you want to add.
8. Click OK to close the Settings dialog box.

Although you cannot use a SCSI drive as the system disk in a Generation 1 VM, you can add virtual data disks to the SCSI controller. In Generation 2 VMs, you must create a SCSI system disk to boot the machine.  Unlike the IDE connectors, which support only two devices each, a SCSI connector in Hyper-V can support up to 64 drives. You can also add multiple SCSI controllers to a VM, providing almost unlimited scalability for your virtual storage subsystem.

Creating differencing disks
A 1differencing disk enables you to preserve an existing virtual disk image file in its original state while mounting it in an operating system and even modifying its contents. For example, when building a laboratory setup, you can create a baseline system by installing a clean copy of an OS on a new virtual disk and configuring the environment to fit your needs. Then you can create a new child-differencing disk using your baseline image as the parent. All subsequent changes you make to the system will then be written to the differencing disk while the parent remains untouched. You can experiment on the test system as you wish, knowing that you can revert to your baseline configuration by just creating a new differencing disk.
You can create multiple differencing disks that point to the same parent image, enabling you to populate a lab network with as many VMs as you need, which saves disk space and eliminates the need to repeatedly install the OS.
To create a cloned version of a baseline installation with a differencing disk, use the following procedure.

1. Install and configure the baseline VM Create a new VM with a new disk image file and install a guest OS on it. Configure the OS as needed and install any roles, features, applications, or services you need.
2. Generalize the parent image Open an elevated command prompt on the baseline system and run the Sysprep.exe utility with the appropriate parameters for your requirements. Sysprep configures the system to assign itself a new, unique security ID (SID) the next time the computer starts. This enables you to create multiple cloned systems from a single disk image.
3. Create a parent disk image Once you have generalized the baseline installation, you no longer need the original VM. You can delete everything except the VHD or VHDX file containing the disk image. This will become your parent image. Open the Properties sheet for the image file and set the read-only flag to ensure that the baseline does not change.

4. Create a differencing disk By using the New Virtual Hard Disk Wizard or the New-VHD cmdlet for Windows PowerShell, create a new differencing disk pointing to the baseline image you created and prepared earlier as the parent image.

5. Create a cloned VM Create a new VM and, on the Connect Virtual Hard Disk page, attach the differencing disk you just created to it by using the Use An Existing Virtual Hard Disk option.

You can then proceed to create additional cloned VMs with differencing disks that all use the same parent. Each one can function independently and the parent disk will remain unchanged.

When you create a differencing drive by using the New Virtual Hard Disk Wizard, selecting the Differencing option on the Choose Disk Type page causes the Configure Disk page to appear as shown in Figure 3-18. In the Location text box, specify the name of the file that you want to use as the parent image.

In the same way, if you create the differencing disk by using Windows PowerShell, you must run the New-VHD cmdlet with the –Differencing parameter and the –ParentPath parameter, specifying the location of the parent disk.

Creating virtual disks

FIGURE 3-18 The Configure Disk page in the New Virtual Hard Disk Wizard.

This article is a part of 70-410 Installing and Configuring Windows Server 2012 Prep course, more articles in this course are :

article

Understanding Active Directory

Active Directory and its Features: Active Directory is the name given to a collection of services created by Microsoft that ...
Read More
article

Active Directory GUI Installation

Before we get to the installation, there are a few things to check to make sure the server is ready ...
Read More
article

Understanding DNS Server

DNS Server is being used too maintain and configure the DNS which is a name resolution service. Public DNS services ...
Read More
article

Maintaining and configuring DNS Forwarding

The act of DNS forwarding refers to the relaying of a DNS request from one server to another one when ...
Read More
article

Planning for a server installation

In versions of Windows Server prior to Windows Server 2008 R2, installation planning could be a complex task. You had ...
Read More
article

Choosing installation options

Many enterprise networks today use servers that are dedicated to a particular role. When a server is performing a single ...
Read More
article

Upgrading servers

An in-place upgrade is the most complicated form of Windows Server 2012 R2 installation. It is also the lengthiest and ...
Read More
article

Migrating roles

Migration is the preferred method of replacing an existing server with one running Windows Server 2012 R2. Unlike an in-place ...
Read More
article

Completing postinstallation tasks

As part of the new emphasis on cloud-based services in Windows networking, Windows Server 2012 R2 contains a variety of ...
Read More
article

Using Server Manager

The Server Manager tool in Windows Server 2012 R2 is an application that is the most obvious evidence of a ...
Read More

70-410 Installing and Configuring Windows Server 2012 Prep course includes following practice tests:

Exam 70-410 Installing and Configuring Windows Server 2012 Practice Test 1

Instructions for Exam 70-410 Installing and Configuring Windows Server 2012 Practice Test 1 This page shows the instructions for Exam ...
Read More

Exam 70-410 Installing and Configuring Windows Server 2012 Practice Test 2

Instructions for Exam 70-410 Installing and Configuring Windows Server 2012 Practice Test 2 This page shows the instructions for Exam ...
Read More

Exam 70-410 Installing and Configuring Windows Server 2012 Practice Test 3

Instructions for Exam 70-410 Installing and Configuring Windows Server 2012 Practice Test 3 This page shows the instructions for Exam ...
Read More

Exam 70-410 Installing and Configuring Windows Server 2012 Practice Test 4

Instructions for Exam 70-410 Installing and Configuring Windows Server 2012 Practice Test 4 This page shows the instructions for Exam ...
Read More

Exam 70-410 Installing and Configuring Windows Server 2012 Practice Test 5

Instructions for Exam 70-410 Installing and Configuring Windows Server 2012 Practice Test 5 This page shows the instructions for Exam ...
Read More