In this blog post, I will create a virtual hard disk and then in the following post, see what we can or cannot do with the virtual disk. I had not taken a look at the most recent advances in this area for a while and wanted to see what is possible with Windows Server 2012 R2. Can we expand and shrink virtual disks when the virtual machine is off? What about when it is running? When can we compact virtual disks? When can we convert the type of a virtual disk? And just what are the different types of virtual disks with Windows 2012 R2?
Just a note: I will examine some aspects that interested me the most. What follows is not intended to cover absolutely each and every characteristic of Hyper-V virtual disks.
So in this first post, I'll create a virtual disk, take that opportunity to present some of the different virtual disk formats and types, and then install an operating system on the virtual disk for experiments that I will conduct in the following blog post.
So in this first post, I'll create a virtual disk, take that opportunity to present some of the different virtual disk formats and types, and then install an operating system on the virtual disk for experiments that I will conduct in the following blog post.
***
Creation of a virtual disk
We can see many of the different options for virtual disks by creating one.
I'll start by opening Hyper-V Manager which we can find in Administrative Tools on a server with the Hyper-V role installed. Next, I highlight the icon representing the Hyper-V host server (in my case, HV1 - see below), right-click on the icon and select New - Hard Disk in the menu:
Note: once the server icon is selected, we can use the Action tab or the Action pane to display the menu options. This is strictly a matter of personal preference.
Click "Next" on the "Before you Begin" page and then select the "format" for the virtual disk:
If you click on the screenshot above (to enlarge), you will see that we have two choices: VHD and VHDX. The first allows a maximum disk size of 2 TB which will be less and less acceptable as the size of hard drives increase. The second format, VHDX, is preferable in most cases. It provides for virtual disks of up to 64 TB in size and is more resistent to disk problems resulting from power failures. On the other hand, we would not chose this format for virtual disks that we would need to store on Windows 2008/R2 hosts. VHDX is only comptatible with Windows 2012 and above.
Next we select the "type" of virtual disk. Each type is presented in the screenshot above but in summary:
- Fixed size: provides the best performance, recommended for production servers.
- Dynamically expanding: the disk is created with almost no space used. If we install an operating system on the disk, it only consumes the space used by the operating system. The size of the disk increases as we add more data. This type of disk is recommended for test environments or for applications with low disk activity.
- Differencing: in this case, we have an existing "parent disk" and then create the differencing disk to which all changes are made. This allows us to revert to the parent disk if necessary. This is very useful in test environments so we can make changes and (if necessary) return to a status quo without having to reinstall the OS or restore an existing state from backup.
For this blog post, I'll select the fixed disk type.
Next, we select a location for the virtual disk. As with virtual technology in general, a virtual disk implies the existence of a physical disk and a file system. I'll name my virtual disk VHD1.vhdx and place it in the following location: F:\VHD\
Now I configure the size of the virtual disk. I'll start at 48 GB. Later, we will see in what circumstances we can expand or shrink this volume:
Here is a summary of the operation:
At this point, I want to install an operating system on the new virtual disk, I want to see not so much what changes I can make to a "dormant" virtual disk but rather what changes can be made with a "live" operating system running on the disk.
***
Creation of a virtual machine (and OS install)
We have a number of options here. For example, we can create a virtual disk when we create the virtual machine itself. There is no requirement to create the virtual disk before. This is what I did in a previous blog post where I presented the installation of the Hyper-V role and the creation of a virtual machine:
Windows Server 2012 - Hyper-V - installation of role, creation of a virtual server
I will (quickly) demonstate the process a second time since there is at least one new feature I want to highlight, even though I will not discuss it in detail here.
So I target the Hyper-V host (HV1 in my case) and then, in the "Action" menu, select New - Virtual Machine:
I choose a name (Svr5) and a location for the virtual machine:
This is the new feature we have with Windows Server 2012 R2: Generation 2 virtual machines (legacy virtual machines are designated as "Generation 1" virtual machines). For this project, I will opt for a simple Generation 1 virtual machine:
I then select the amount of memory I want to assign to the virtual machine and indicate if I want to use Dynamic Memory.
Note: I later increased the memory to 1024 MB. The guest operating system I selected for the virtual machine was Windows 2012 (RTM) and while 512 MB of RAM is the supported minimum, I thought I would gain some time for the exercises with more RAM.
I select the network connection:
And then the virtual hard disk I have already created:
I click "Finish" on the Summary page (not shown here) and then install Windows 2012 (RTM) for the tests that will be conducted in my next blog post.
Thank you for reading the article about Windows Server 2012 R2 - Hyper-V - a look at VHD features (Part 1) on the blog NEW TECH If you want to disseminate this article on please list the link as the source, and if this article was helpful please bookmark this page in your web browser by pressing Ctrl + D on your keyboard keys.