Logo

Virtual Hard Disk Demonstration

This video will look at how to create virtual hard disks on Windows Server 2012 R2 using the VHD and VHDX format. The video will also look at how to convert between the different formats. The principles used in this video also apply to client operating system.

<a class="wp-block-button__link"Download PDF handout
Show lesson content
Demonstration creating virtual disks in Disk Management
1) To create and manage virtual disks this can be done with “Disk Management”. “Disk Management” can be opened by right clicking on the start menu and selecting the option “Disk Management”.

2) To create a new VHD, open the action menu and then select the option “Create VHD”.

3) To create a new virtual hard disk, enter in the location you want to create the virtual hard disk at the top of the screen.

4) Under the location select the size of the virtual hard disk that you want to create. If you create a virtual hard disk using the VHD format then the largest virtual hard disk you can create is 2040 Gigabytes. If you use the VHDX format you can create a virtual hard disk that is up to 64 Terabytes in size. The VHDX format is only supported on Windows Server 2012 and Windows 8 and above. The VHDX format offers additional performance features as well as transaction logging.

5) In the middle of the screen select the format you want to use to create the virtual machine. Either VHD or VHDX.

6) At the bottom you can choose if the virtual hard disk is fixed in size or dynamically expanding. The size of the dynamically expanding virtual disk will be same as the amount of data stored on the virtual disk. The fixed option creates a file the same size as the virtual disk. This makes performance of the virtual disk faster, however it does mean that more disk space will be used.

7) Once a virtual disk is created it will automatically be mounted and thus will appear in disk management. The icon used in disk management will be blue to indicate that it is a virtual disk. The icon used for physical hard disks will be grey. If the computer is restarted the virtual hard disk will need to be mounted again. If you want the virtual disk to be automatically mounted during start up, a script will need to created and run at start up to mount the virtual disk.

8) Like a newly installed physical hard disk with data on it, the virtual hard disk will need to be initialized before it can be used. To do this, right click on the virtual hard disk and select the option “Initialize Disk”. In this case MBR will be used, however you could use GPT as well if the hardware that you were planning to use the virtual disk on supported GPT.

9) Once the disk has been initialized it will be able to be formatted. To do this, right click on the virtual disk and select the option “New Simple Volume”. You are free to choose your own options, however in this case all the defaults were used. This will create a drive using all the free space and format it with NTFS.

Demonstration creating virtual disks using PowerShell
1) To open PowerShell, press the PowerShell icon in the quick launch bar.

2) If you run the command convert-vhd in PowerShell you will get an error message saying the Hyper-V role needs to be installed. To install Hyper-V, assuming the server meets the requirements, open Server Manager and select the option on the welcome screen “Add roles and features” and then from the wizard accept all the defaults except for ticking the role “Hyper-V” on the “Select server roles” screen. Part of the install will install the module “Hyper-V Module for Windows PowerShell” which is what you need to run the PowerShell commands. Unfortunately the whole Hyper-V role needs to be installed in order for the PowerShell commands to work. If you are not able to install Hyper-V on the server, it is also possible to run these PowerShell commands on Windows clients like Windows 8 assuming the Hyper-V role is installed on those clients. The server or client will need to be restarted after the install.

3) To convert a VHD file from one format to another use the PowerShell command Convert-VHD –Path (Source) –DestinationPath (Dest). e.g. Convert-VHD –Path c:\DataDrive.vhd –DestinationPath c:\DataDrive.vhdx

4) To create a new virtual disk, run the command New-VHD. In this case a differencing virtual disk was created using the following command. New-VHD –Path (filename) –ParentPath (filename) –Differencing

Demonstration Hyper-V
The Hyper-V Management tool can be used to convert virtual disks from one format to another and also change the format of the virtual disk, for example changing the format from VHD to VHDX.

1) Open Server Manager and then from the tools menu select the option “Hyper-V Manager” to open Hyper-V Manager.

2) From Hyper-V Manager, select the option on the right hand side “Edit Disk”. This will start the edit virtual disk wizard.

3) In this example, the virtual disk that will be selected is a differencing disk that will be changed to a dynamically expanded disk. A differencing disk requires two files in order to operate. One is the master file and the other file contains the differencing file. Once the conversion has finished only one file is required.

4) The wizard has four options that can be done to the virtual machine. In this example the merge option will be used to convert a differencing virtual disk into a dynamically expanding disk.
Compact: This removes any unused space in the virtual disk. When virtual disk files are deleted or modified, this will often expand the virtual disk. Compacting the virtual disk will reclaim this space.
Convert: This allows a virtual hard disk to be converted between two different formats. For example, you could convert a VHD to a VHDX file.

Expand: This option allows the administrator to increase the size of an existing virtual disk.

Merge: This allows a differencing disk that contains more than one file to be merged into the one file.

5) The next screen of the wizard will ask when the changes will be stored. The default option will merge the changes into the parent differencing disk. This essentially commits all the changes to the parent disk and leaves the differencing disk empty. Once changes are made to the virtual disk these will be saved to the differencing disk. In this case the option “To a new virtual hard disk” will be selected which will create a single virtual hard disk. In this case the dynamic virtual hard disk will be created. So the changes are being merged and the differencing disk is being converted to a dynamic virtual disk

6) Once the options have been selected, complete the wizard and the changes will be made.

Demonstration changing settings in virtual machine
1) To change the virtual hard disk settings in a virtual machine, right click the virtual machine and select settings.

2) On the left hand side, select the option for hard disk. On the right hand side under Media you will notice the filename that is currently being used for the virtual hard disk.

3) If you want to change the hard disk that the virtual machine is using you can press the browse button. The edit button is also available if you want to make changes. The inspect button will tell you information about the virtual hard disk, for example if it is fixed or dynamic.

References
“Hyper-V” http://en.wikipedia.org/wiki/Hyper-V#System_requirements
“Installing and Configuring Windows Server 2012 Exam Ref 70-410” pg 48-50

Credits

Lesson tags: 70-410-windows-server
Back to: 70-410 Installing and Configuring Windows Server 2012 > Basic Windows Server Configuring

Installing and Configuring Windows Server 2012

Modules

DNS

Lessons