Insight into Hyper-V Storage

Exclusive offer: get 50% off this eBook here
Windows Server 2012 Hyper-V: Deploying Hyper-V Enterprise Server Virtualization Platform

Windows Server 2012 Hyper-V: Deploying Hyper-V Enterprise Server Virtualization Platform — Save 50%

Building Hyper-V infrastructure with secured multitenancy, flexible infrastructure, scalability, and high availability with this book and ebook.

A$29.99    A$15.00
by Zahir Hussain Shah | May 2013 | Enterprise Articles

In this article by Zahir Hussain Shah, the author of Windows Server 2012 Hyper-V: Deploying Hyper-V Enterprise Server Virtualization Platform, we will dive deeper into Hyper-V storage, where we will discuss the various types of storage options available with Microsoft Windows Server 2012 Hyper-V for a virtual machine in detail.

(For more resources related to this topic, see here.)

Understanding virtual storage

A virtual machine that simulates the same computing architecture as the physical machine holds the virtual storage for its operating system. This storage can be set up in many different ways, where a virtual machine can have the same or different sizes of storage at the same time. This virtual storage can be accessed by the guest operating system, and in the case of a file server or other content and application server based virtual workloads, it can also be made available to the users accessing the virtual machine, and the hosted and shared connections can be accessed from there.

A virtual machine can have different types of virtual storage, but from the early days of x86-based virtualization, file-based virtual storage or specifically the virtual hard disk (VHD) type of virtual machine storage is famous and the most widely used. There are other types of virtual storage such as pass-through disks, where the administrator attaches the physical or local disk of hypervisors to the virtual machine, so the virtual machine is not writing on a file-based virtual storage but a physical disk or SAN LUN attached to the hypervisor machine, which is then made available to the virtual machine as a pass-through disk.

Virtual machine storage requirements are based on the type of server role and application running and the workload. This emphasizes the need to configure the correct type of virtual storage required by the virtual machine. For example, let's say we have a requirement to install a database server application, for instance Microsoft SQL Server; in this case, SQL Server may require several types of storage, such as an OS disk, application disk, database files (MDF), and database logs (LDF). So for each of these types of storage, we may configure and provide the virtual storage for our SQL Server virtual machine as follows:

Virtual storage type

 

Purpose

 

VM disk

 

VHD - file-based virtual storage

 

OS installation

 

C:

 

VHD - file-based virtual storage

 

System page file (SWAP)

 

D:

 

VHD - file-based virtual storage

 

Application installation

 

E:

 

Physical disk - pass-through

 

Database files (MDF)

 

M:

 

Physical disk - pass-through

 

Database logs (LDF)

 

L:

 

The preceding table shows the recommended types of virtual storage needed for the Microsoft virtual machine. So in this case if an administrator chooses a wrong type of virtual storage, it will result in a low-performance disk with slow I/O allotted to the SQL Server database or transactional logs, which would then result in poor SQL Server database performance.

Later on in this article, we will discuss the best storage practices for a Hyper-V virtual machine, which will guide you to choose the correct type of virtual machine storage for your critical virtual machines; we will also discuss a few real-world scenarios where insufficient planning and inadequate virtual machine resources can affect virtualization projects negatively, after which we will address the solution to overcome these issues related to performance and virtual machine storage.

For a better understanding of virtual storage, let's first start by discussing the numerous new virtual machine storage features that have been introduced in Windows Server 2012 Hyper-V 3.0. Then we will discuss the various types of Hyper-V storage for virtual machines, which will provide you with end-to-end knowledge about the different types of virtual storage you can use for your virtual machine.

Improved Hyper-V storage

Windows Server 2012 Hyper-V has introduced a series of improvements for virtual machine storage. All these new storage features and improvements in the existing storage types for virtual machines have allowed Hyper-V to fully cater for the end-to-end needs of server virtualization.

In the earlier version of Hyper-V, there were a few caveats for virtual machine storage selection. These virtual machine storage caveats didn't allow customers to select relaxed and flexible virtual machine storage platforms. One of the examples of these types of rigid storage selections for virtual machines is that virtual machine storage cannot be placed on an SMB file share. There are other major problems with virtual machine storage selection that we saw in the previous Windows Server and Hyper-V releases. These problems are as follows:

  • Inability to perform live storage migration

  • Incapability of connecting the virtual machine to fibre channel storage

  • Limited size of virtual hard disk, that is, 2 TB

  • Difficulty in building a guest virtual machine cluster with only iSCSI SAN

  • Incapability of performing a disk merge operation while the VM is running

Microsoft Windows Server 2012 addresses all these problems that customers were faced with in the earlier versions of Windows Server and Hyper-V. Now let's go ahead and discuss how Windows Server 2012 and Hyper-V address these problems related to virtual machine storage and provide flexible virtual machine storage selection for customers.

The following newly added features and enhancements of Windows Server 2012 Hyper-V now make it much easier for customers to select a wide variety of virtual machine storage options:

  • Virtual Fibre Channel connectivity for a virtual machine

  • Larger virtual hard disk support of up to 64 TB

  • Virtual machine storage and live virtual storage migration based on Server Message Block (SMB)

  • The possibility of relaxed virtual machine clustering with virtual Fibre Channel

  • Native disk support of 4 KB sectors

  • Live disk merging operations for a virtual machine hard disk

  • Availability of secure offloading data transfer for virtual machine storage

Let's now discuss a few of the preceding new features added to Hyper-V storage in detail.

Virtual Fibre Channel connectivity for virtual machines

This is one of my favorite features within Windows Server 2012 Hyper-V. This feature allows Hyper-V based virtual machines to access external SAN storage based on the Fibre Channel. This will open a new door for building clustered virtual machines and making your critical workloads highly available with fully supported Fibre Channel SAN storage.

Working of Hyper-V Virtual Fibre Channel

Hyper-V Virtual Fibre Channel for virtual machines in Windows Server 2012 works in a manner similar to the physical connectivity that was established when you connected a physical server to the Fibre Channel SAN storage. For Hyper-V Fibre Channel connectivity for virtual machines in Windows Server 2012, we use N_Port ID Virtualization (NPIV) technology. As a process of virtualizing your Fibre Channel SAN, an NPIV port is created on the server running Hyper-V and is associated with the virtual Fibre Channel adapter. Additionally, a World Wide Name (WWN) is assigned to the NPIV port, which allows all I/O to be redirected to a specific virtual Fibre Channel adapter in the virtual machine.

In Windows Server 2012, Hyper-V connectivity to the Fibre Channel storage is done by using multipath I/O (MPIO); this ensures continuous connectivity to the Fibre Channel storage from within the virtual machine. In addition to all these great characteristics of the MPIO feature, we can also configure multiple virtual Fibre Channel adapters in a VM, while at the same time, we can also separate each copy of the multiple MPIO paths within the OS of the virtual machine, to connect to the SAN LUNs.

Larger virtual hard disk support (up to 64 TB)

We all loved virtual hard disk (VHD) because of its simplicity and ease of implementation among its other features/characteristics. But while working with Windows Server 2008 / 2008 R2, we saw a caveat where VHD failed to fulfill the requirement of having a larger virtual hard disk because of its limited maximum size of 2 TB. Usually, people encounter this problem when they run/are running a file server or any other server application that requires a larger amount of disk space.

In Windows Server 2012 Hyper-V, Microsoft introduced a new format of virtual hard disks for virtual machines that is called VHDX. Here "X" represents the extended capabilities of VHD, where a VHDX can now be as large as 64 TB, which is a far bigger size than the original VHD format.

This new format with an extended maximum size addresses all the past problems of building virtual machines with a larger virtual hard disk.

In addition to this, VHDX also provides the following list of benefits over the VHD format:

  • It increases performance for applications and workloads, especially on physical disks that have a sector size larger than 512 bytes

  • It supports the storage of custom metadata

  • It logs updates to the VHDX metadata structures

  • It supports larger block sizes for dynamic and differencing disks, which allows the disks to be tuned in to the needs of the virtualized workloads

  • It allows you to configure and manage virtual hard disks on a computer running Hyper-V, using Windows PowerShell commands

SMB-based virtual machine storage

Before we go ahead and explain this feature in detail, let me point out a limitation of Hyper-V Windows Server 2008 / 2008 R2, which we all faced in the past. Small- to medium-sized companies faced the biggest problem of making larger disks locally available to Hyper-V server to virtualize more servers and applications from their infrastructure. Due to having a limited amount of local disk space, we always saw ourselves in a bit of a problem. And while dealing with this problem, we all thought of using SMB storage for Hyper-V because of its feasibility and availability, where we could store virtual machines on a file server, but it was not available in earlier versions of the Hyper-V server.

Good news! Windows Server 2012 Hyper-V supports storage based on SMB 3, which could be your Windows file server, for storing data related to the virtual machine, including virtual machine configuration files, virtual hard disks (VHD/VHDX), and virtual machine snapshots (AVHD). This new feature makes it very easy for small- to medium-sized organizations to create more virtual machines, while having limited amount of disk space available on their Hyper-V servers locally.

Okay, we read the good news; now let's read a bit about SMB 3. SMB 3 allows you to use your file server storage for Hyper-V virtual machine placement. This will enable you to store virtual machines based on Hyper-V on the cheaper disks of the file server. While on the one hand it may save some dollars, on the other hand it may affect the virtual machine's storage performance.

Moreover, you can also enhance network performance by using the Hyper-V server's NICs that support the Remote Direct Memory Access (RDMA) feature. This will enable all the functionalities to work on low latency and CUP, while working at full speed. While using an SMB-based file server as storage for your Hyper-V server, you can have all the benefits that you used to have when using SAN storage for your Hyper-V virtual machine storage.

Virtual machine live storage migration

There are many situations where critical virtual machine storage needs to be migrated from its current storage platform to a different one. This could be because there is a need to migrate the virtual machine's storage from a slow disk to a faster one, or there could be many more reasons. In the previous releases of Windows Server 2008 and Hyper-V, migrating virtual machine storage for running workloads was not possible. And the only solution we had was to bring down the virtual machine to migrate its storage platform.

Windows Server 2012 Hyper-V addressed this problem with all its other features and has now made it possible for customers to perform live migration of virtual machine storage from one location to another.

Types of Hyper-V virtual storage

In the previous section, we discovered what virtual storage is and how it contributes to the server virtualization architecture. With all the information we got from the previous section about virtual storage, let's now move ahead and see the virtual machine storage options that Hyper-V offers us.

In this section, we will go through different types of virtual machine storage options, such as VHD, VHDX, fixed disk, dynamic disk, differencing disk, and pass-through disk. We will discuss each of them in detail so that you understand all their ins and outs for better planning and sizing.

Each of these virtual storage options has a different set of properties than the others, and the administrator must choose the correct virtual storage that best fits the server operating systems and application needs.

Let's now start by discussing each of these virtual storage options for virtual machines based on Hyper-V.

Virtual disk formats

First we must select the virtual disk format before we go ahead and create the virtual hard disk file. There are two possible virtual disk formats available with Windows Server 2012 Hyper-V; they are VHD and VHDX. Let's first make a short comparison between the two virtual hard disk formats, which will provide us with some quick guidance on making the appropriate selection according to the usage.

Feature

 

VHD

 

VHDX

 

Disk size

 

Up to 2 TB

 

Up to 64 TB

 

Native disk support of 4 KB

 

Not supported

 

Supported

 

Secure offload data transfer

 

Not supported

 

Supported

 

Virtual hard disk (VHD)

After the release of Hyper-V, Microsoft provided its customers with a native hypervisor for their server virtualization needs. But this newly released product had to face challenges for being called an enterprise virtualization platform. And virtual hard disk (VHD) limitation was one of the caveats that customers faced.

There are a few limitations to the VHD format; one is the limited size of the virtual hard disk (which we faced before) and another is the possibility of data inconsistency due to power failures. Virtual hard disk (VHD) is a file-based storage for your virtual machine that is based on Hyper-V; this is a default and basic level of storage functionality for a virtual machine. An administrator can create a virtual hard disk (VHD) file for a virtual machine within Hyper-V for a specific size, where defining the size is mandatory. This VHD file can have a different set of properties based on its type.

A virtual hard disk (VHD) file or file extension is similar to the VMKD file format, which is a VMware virtual machine hard disk extension. VHD files also existed in the earlier versions of server and desktop virtualization software from Microsoft, for example, Virtual PC and Virtual Server.

Virtual hard disk (VHDX)

As we saw, the two main limitations of VHD format based virtual hard disk are size and data inconsistency due to power failure; Microsoft addressed these two main limitations of the VHD file format and introduced a new virtual hard disk format called VHDX. This virtual hard disk format allowed customers to create virtual hard disks of up to 64 TB, where earlier the virtual hard disk format (VHD) only allowed virtual hard disks up to the size of 2 TB. Also, as this new format has a resilient architecture, the possibility of data corruption due to power failure also reduced.

Virtual disk types

The virtual hard disk format decides the maximum size of a virtual hard disk, while the virtual hard disk type decides the functionality and features a virtual hard disk will provide. Microsoft Windows Server 2012 Hyper-V provides four types of virtual hard disks for virtual machines based on Hyper-V. These four virtual hard disk types are as follows:

  • Dynamic disk

  • Fixed disk

  • Differencing disk

  • Pass-through disk

You should choose the virtual hard disk type based on your server and application requirements. Each type of virtual hard disk provides different set of disk performance and functionalities, so proper planning is highly important to ensure that you select the right virtual storage for your workload.

Let's now discover each of these storage types in detail.

Dynamic disk

When you create a new virtual machine, and create a new virtual hard disk from New Virtual Machine Wizard, the wizard chooses the dynamic disk as the virtual hard disk type for you. Dynamic disks, as they sound, are dynamic; this means they get changed over time or due to the occurrence of certain events. Dynamic disks are the best choice for economic usage of the server's storage. With whatever size of dynamic disk you create, it won't immediately deduct the same amount of disk space from the physical storage of the Hyper-V server but instead will get created with a very small size, and over a period of time, keep growing as you put data and content on this disk. This dynamic growth of a disk is the actual concept behind this type of virtual hard disk.

Since dynamic disks are not of a fixed size and are actually small in size, they cannot deliver a good disk I/O for storage-intensive applications.

Real-world example

Over the years, I have seen many cases where a production workload (VM) has had performance bottlenecks, especially for the disk subsystem of a virtual machine. And among these, in the case of performance problems related to the virtual machine disk subsystem, the majority of times I saw people using dynamic virtual hard disks for their production workloads. And since dynamic disks do not have a fixed size storage for virtual machines, they are not a good choice for disk-intensive applications and server roles. A dynamic disk has another problem of not being able to provide good results for disk fragmentation or other similar activities due to its design. Dynamic disks are good for the testing and research and development types of virtual machines where the performance factor is not very important.

Now let's see how we can create a dynamic disk for a virtual machine.

As we have said previously, when you create a virtual machine via New Virtual Machine Wizard, it also gives you the option to create a virtual hard disk for the virtual machine by default. This wizard for creating a new virtual machine, along with the creation of the virtual hard disk, provides a dynamic disk by default, and so the disk type option is not provided as a selection option.

In the following brief steps, we will see how to create a dynamic disk:

  1. Open Hyper-V Manager from Administrative Tools.

  2. From the Hyper-V Manager snap-in, find the New button on the right action pane and click on Hard Disk.

  3. New Hard Disk Wizard will open; it will first ask you to select the hard disk format, which could be either VHD or VHDX, depending on the size of your hard disk.

  4. Then you will be prompted to select the disk type; here we will select Dynamic Disk.

  5. The next section of New Hard Disk Wizard will ask you the name of the virtual hard disk and the location where you want this virtual hard disk to be created and stored.

  6. Now the last section of this wizard will ask you the size of the disk you want to create. This section also gives you the functionality to copy content from a physical disk of the server or any other virtual disk that has already been created.

Fixed disk

A fixed disk is like a static disk that has a fixed size and doesn't grow over time if we go on adding content to it. Fixed disks provide better performance as compared to dynamic disks, because when we create a fixed disk of 100 GB, Hyper-V creates a VHD or VHDX file of 100 GB. It should be noted here that creating this 100 GB fixed disk will take a long time as it has to create a VHD/VHDX file of 100 GB, and the larger disk you create, the longer time it will take. A fixed disk allocates a fixed size from the physical storage of the Hyper-V server, and so this big chunk of allocated disk space allows the virtual machine to receive better I/O performance from this type of virtual hard disk.

Fixed disks are always recommended for production workloads because their better performance allows administrators to perform faster read/write operations on virtual disks. Fixed disks are mainly created for virtual machines that run disk-intensive applications, where a high disk I/O is required for virtual machine storage, for example, the virtual hard disk you will create if you are going to virtualize a file sever. Here you will store all the files to the hard disk and so it should be a fixed disk, but at the same time the operating system disk of the file server can be kept as a dynamic disk because there will not be much disk activity on it.

To create a fixed disk, you need to perform the following steps:

  1. Open Hyper-V Manager from Administrative Tools.

  2. From the Hyper-V Manager snap-in, find the New button on the right action pane and click on Hard Disk.

  3. New Hard Disk Wizard will open; it will first ask you to select the hard disk format, which could be either VHD or VHDX, depending on the size of your hard disk.

  4. You will then be prompted to select the disk type; here we will select Fixed Disk.

  5. The next section of New Hard Disk Wizard will ask you for the name of your virtual hard disk and the location where you want this virtual hard disk to be created and stored.

  6. Now the last section of this wizard will ask you the size of the disk you want to create. This section also gives you the functionality to copy content from a physical disk of the server or any other virtual disk that has already been created.

Differencing disk

A differencing disk has a parent-child model associated with its architecture. Mainly, it comes into use when an administrator takes a snapshot of a virtual machine, where after creating the snapshot, Hyper-V leaves the first parent VHD intact and creates a new child disk that gets linked to the parent virtual hard disk. Both parent and child disks always have the same disk format; this means that if the parent disk is created as VHD, the child disk cannot be VHDX.

A differencing disk is usually never recommended for production workloads because if you to create a snapshot of a production workload, you will stop writing to the production virtual hard disk. Differencing disks are the same in nature as dynamic disks, where the disk size grows over a period of time as we go on adding more data to the disk; this nature of the disk may not give you good performance for the disk subsystem of the production workload.

Another problem with the differencing disk is that when we create a snapshot of the virtual machine, from that point in time, all the data gets written on to the differencing disk and your parent VHD/VHDX becomes idle and isolated from the new data changes. And in the case of multiple snapshots you will have data written on multiple differencing disks. So if any of the differencing disks (snapshots) get misplaced or deleted, you will lose all the data that was written on it at that particular period of time. So in a nutshell, it is highly recommended not to create a snapshot of a production virtual machine; but if you have taken it already, make sure that you restore it to its parent VHD/VHDX as early as possible.

To create a differencing disk, you may perform the following steps:

  • Previously, we saw the steps for creating other disk types; follow those same steps until we reach the step where we need to select the disk type.

  • When we are prompted to select the disk type, select Differencing Disk.

  • The next section of New Hard Disk Wizard will ask you the name of the virtual hard disk and the location where you want this virtual hard disk to be created and stored.

  • Now the last section of this wizard will ask you the size of the disk you want to create. This section also gives you the functionality to copy content from a physical disk of the server or any other virtual disk that has already been created.

Pass-through disk

A pass-through disk is a storage type in which an administrator presents a physical hard disk, which is associated or attached to the Hyper-V host server, to the virtual machine as a raw disk. This type of virtual machine storage is called a pass-through or raw disk; in this type of storage, the physical disk or LUN passes through the hypervisor and later to the virtual machine guest system. This physical disk that is associated or attached to the Hyper-V server could be a SAN LUN storage bound to the Hyper-V server, or it could be a locally installed physical hard disk.

To mitigate all these aforementioned risks, administrators prefer to use a pass-through disk as a local disk for highly critical virtual workloads and keep the virtual machine storage on this pass-through disk. As a first step, the pass-through disk is attached or made available to the Hyper-V server; once the disk is available to the server, you have to bring the disk offline before you pass the disk through to a virtual machine available on the same Hyper-V box. We cannot make a partition on the disk available to a virtual machine; it is only the local disk of the Hyper-V server that can be made available as a pass-through disk.

In many cases, admins prefer to use pass-through disks instead of using VHDs, especially if they want their virtual machine to boot from a SAN LUN, or in the case of databases, where an Exchange Server mailbox database can be placed on pass-through SAN LUN disks. Pass-through disks are also suitable for environments where the application's high availability methodology is placed on a build blocks level. In these types of high availability requirements for the application, an administrator needs to bind the same data disks (pass-through LUNs) to another virtual machine, and you are all good to go.

It should also be noted here that pass-through disks don't get included in a backup based on a VSS snapshot. This means that if you have taken a backup of a virtual machine using a VSS-based backup solution, all the pass-through disks of the virtual machine will not be backed up and only the VHD-based/VHDX-based disks will be included in the VSS snapshot backup.

The following steps need to be carried out to provide a pass-through disk to a virtual machine within the Hyper-V server:

  1. Open Hyper-V Manager from Administrative Tools.

  2. Take the virtual machine settings that you want to configure and add a pass-through disk.

  3. Add SCSI Controller from the Add Hardware section of the virtual machine settings, or if you wish, you can also add a physical disk to an IDE controller. Then select the hard drive and click on the Add button.

  4. Once you click on the Add button at the controller level, you will be prompted to select the physical hard drive that you want to connect to the virtual machine.

  5. After selecting the appropriate disk, you need to connect it to the virtual machine. First click on Apply and then click on the OK button to commit the changes.

Virtual Fibre Channel SAN

With the release of Windows Server 2012, Hyper-V now offers virtual FC SAN connectivity to virtual machines, to allow virtual machines to connect to a virtual SAN. The administrator first connects a virtual SAN network setup on the Hyper-V server, just like what we would do to create a virtual switch for different network segments. Once the virtual fibre SAN network gets set up, the Fibre Channel adapter can be added to the virtual machine that needs to be associated with the Fibre Channel SAN network.

Hyper-V allows the Hyper-V administrator to configure WWNs and other settings related to Fibre Channel SAN; all these settings can be customized from the virtual machine Fibre Channel adapter or as global settings from the Fibre Channel network of the virtual SAN manager.

The preceding screenshot describes the connectivity of a standalone Hyper-V server to the FC SAN. In the first phase of connectivity, our Hyper-V server gets connected to the FC SAN switch through a Fibre Channel medium. Then in the second phase of connectivity, we configure the virtual Fibre Channel switch on the Hyper-V server. Once the virtual fabric switch is configured, we can simply add the virtual Fibre Channel adapter to the virtual machine and connect the adapter to the virtual Fibre Channel switch.

Windows Server 2012 Hyper-V: Deploying Hyper-V Enterprise Server Virtualization Platform Building Hyper-V infrastructure with secured multitenancy, flexible infrastructure, scalability, and high availability with this book and ebook.
Published: March 2013
eBook Price: A$29.99
Book Price: A$49.99
See more
Select your format and quantity:

Virtual machine storage settings

In this section, we will go through the different sets of available virtual machine settings for storage, where we will see all the available settings that can be customized as per our need.

This section will mainly focus on two types of virtual machine storage settings. In discussing the first type of storage setting, we will understand the different types of storage settings available within Hyper-V virtual machine settings that allow you to add or remove storage from a virtual machine.

In discussing the second type of virtual machine storage setting, we will understand the different utilities that come within Hyper-V for managing and troubleshooting your virtual machine storage.

Now let's go and discover these two types of storage management settings for your Hyper-V virtual machines.

Virtual machine hard disk settings

Virtual machine hard disk settings represent those sets of settings that allow you to add storage to or remove storage from the virtual machine; this may be based on either the IDE controller or SCSI controller. In this subsection, we will cover all these settings that are available to be customized and set.

We will first start with the controllers; there are two types of virtual machine hard disk controllers available on a Hyper-V based virtual machine, as follows:

  • IDE controller

  • SCSI controller

Now let's discuss each of these controllers in detail.

IDE controller

When you create a virtual machine, the IDE controller is added to the virtual machine by default, and can be used to attach a hard disk and/or DVD drive for the virtual machine to use. It should be noted here that a virtual hard disk containing a virtual machine operating system can only be attached to an IDE controller; you cannot add a virtual hard disk to an SCSI controller for the virtual machine operating system to boot up.

There are two controllers available for an IDE, namely IDE Controller 0 and IDE Controller 1. Other than these you cannot add additional IDE controllers to the virtual machine, and even if you see the Add Hardware section, you will not see the IDE controller there. IDE controllers cannot be deleted from the virtual machine, unlike SCSI controllers. In a virtual machine based on Hyper-V, you can only add one DVD drive, and it cannot be added to an SCSI controller. Both IDE and SCSI controllers can be used for configuring and adding a physical disk. In other words they can be configured as pass-through disks.

SCSI controller

On a single virtual machine based on Windows Server 2012 Hyper-V, you can add up to four SCSI controllers. SCSI controllers are different from IDE controllers because they require Hyper-V Integration Services to be installed on the virtual machine whereas IDE controllers don't. SCSI controllers can also be configured as pass-through disks. As we mentioned in the IDE controller subsection, it is not recommended to add the system drive to an SCSI controller; it should be connected to an IDE controller.

Hyper-V virtual hard disk utilities

Now let's see the other types of Hyper-V virtual machine storage settings; these other types of settings are made through utilities that are wizard based and that manage virtual machine storage. We can also call them the advanced settings for Hyper-V virtual machine storage that allow us to customize VHDs, edit them, and merge them (in the case of differencing disks).

Now let's understand the various features and functions of these utilities in detail.

Edit disk

Edit disk is a wizard-based utility that allows us to edit a virtual hard disk. We can edit both types of virtual hard disks, be they VHD or VHDX. Edit disk is an advanced type of virtual hard disk utility; it can be used for the following functions:

  • Compact

  • Convert

  • Expand

Now let's discuss the functions of each of these functions in detail.

Compact

Compacting a virtual hard disk allows an administrator to shrink the size of the virtual hard disk but doesn't change anything for the storage capacity of VHD/ VHDX. There are times when compacting a virtual hard disk becomes necessary, and using the compact feature of edit disk is safer and allows you to free the unavailable storage space on your Hyper-V physical server.

To perform a virtual hard disk compact function, please perform the following steps:

  1. Open Hyper-V Manager from Administrative Tools.

  2. From the right-hand side action pane, click on Edit Disk.

  3. The next step is to locate the disk. You have to browse and select the virtual hard disk (VHD/VHDX) on which you want to perform the disk compacting operation.

  4. In the Choose Action section of Edit Virtual Hard Disk Wizard, we have to select the action that we want to perform; since in this example we want to compact the virtual hard disk of the virtual machine, select Compact and click on Next.

  5. In the last window, you will be presented with a summary of the disk name and the action you selected to be performed on the disk.

Convert

Another feature that the edit disk utility provides is converting the virtual hard disk for virtual machines based on Hyper-V. Using the edit disk's converting feature, you can convert a virtual hard disk to a different type or different format. This conversion process creates a new hard disk from the one that you wish to convert and keeps the original disk intact. In the disk conversion process, the contents of the original disk are copied and added to the new disk with the format that the administrator selects.

For example, let's say that you have a virtual hard disk for a virtual machine that is currently running as VHD, and due to some size issues with the virtual hard disk, you want to expand the disk; in this case, you might want to convert the disk format from VHD to VHDX, and for this purpose you can use edit disk's convert feature. In this way, you can have a bigger disk with an extended disk capacity.

We will continue with the same preceding example. After selecting the disk format to be changed from VHD to VHDX, we also want this virtual hard disk to be a fixedsize disk, because earlier we created this virtual hard disk as a dynamic disk, and it has been noticed that with the dynamic disk, we have been getting a slow response during the peak times of virtual machine usage. So for this requirement, you can select the disk type to be changed from the dynamic to the fixed disk.

For the process of converting the disk, you can follow the screenshots shown previously. After selecting the intended disk type to be used for the conversion, you can click on Next to go to the Configure Disk screen and provide the path where you want to create the new disk with all the contents from the original disk; lastly, click on the Finish button and wait for the conversion process to kick in.

Expand

This is one of the most widely used features of the edit disk utility, where an administrator can expand an existing virtual hard disk of any type and any format to a new and bigger size. Mostly, administrators use this feature to expand the disk size of a fixed disk, because by their nature, they take the same physical space from the Hyper-V storage; so initially, people create a fixed disk with a smaller size, and later when their data grows and they want to expand the disk size, the disk expansion process comes into the picture.

You can perform the disk expansion process for your virtual hard disk by performing the following steps:

  1. Open Hyper-V Manager from Administrative Tools.

  2. Click on Edit Disk from your right action pane; this will open the Edit Virtual Hard Disk Wizard utility, as shown in the following screenshot:

  3. On the Locate Disk screen, browse to the virtual hard disk for which you want to perform disk expansion and click on Next to go to the next window.

  4. From the Choose Action selection area on the first screen, select the Expand radio button and click on the Next button.

  5. Now on the Configure Disk screen, we have to specify the new size of the virtual hard disk that we want. Let's say your virtual hard disk was initially created with 100 GB of space and now you want to expand it to 200 GB; so in the New size field from the Configure Disk screen, specify the size that you want to keep for the virtual hard disk and click on the Next button, as shown in the following screenshot:

  6. Finally, click on the Finish button to start the expansion process.

The disk expansion process will take some time and finish with the extended virtual hard disk size.

Inspect disk

The inspect disk utility is a great feature for virtual hard disk files; it is very important and handy while troubleshooting issues related to the virtual hard disk. Let's say you had created a virtual hard disk for your Exchange Server in the past and, after some time, forgotten about the type of virtual hard disk you used; if you want to quickly recall this, you can open the inspect disk functionality, which will tell you about the type of the virtual hard disk.

To use the inspect disk utility, you can perform the following steps:

  1. Open Hyper-V Manager from Administrative Tools.

  2. From the right action pane, click on the Inspect Disk utility.

  3. This opens the file browser window, from where you can browse to the file and select it for inspection.

Now here is the beauty of the inspect disk utility. Let's take two examples here; in the first example, we want to inspect the disk type of our virtual hard disk. So in the inspect disk utility, we will browse to the virtual machine folder and select the virtual hard disk we want to know the type of.

Hyper-V gives us the following information about the disk, where we can see the type of virtual hard disk used and the virtual hard disk format:

Let's continue with our second example, where we have a virtual machine that we have taken a snapshot of to depict the previous state of the virtual machine before the company's custom-made financial application was installed on it. And now before we merge the snapshot with the parent VHD, the Hyper-V administrator wants to have a look at the parent disk for the differencing disk's chain health before performing the merging process.

So we will check the differencing disk's snapshot file with an AVHD extension by opening the inspect disk utility, and from the browse file window, we will select the AVHD file for inspection; it will give us the following information that the type of the disk is a differencing disk and the format of the disk is VHD, and most importantly, it will give us information about the name and location of the parent VHD file:

The inspect disk utility also allows us to inspect the parent disk from the same differencing disk inspection report we used to inspect the root VHD or parent VHD. So if we click on the Inspect Parent, we will be presented with the following report:

So you can see that our snapshot file has a root VHD or parent VHD located in the same directory, which is a VHD file and a dynamic disk.

Windows Server 2012 Hyper-V: Deploying Hyper-V Enterprise Server Virtualization Platform Building Hyper-V infrastructure with secured multitenancy, flexible infrastructure, scalability, and high availability with this book and ebook.
Published: March 2013
eBook Price: A$29.99
Book Price: A$49.99
See more
Select your format and quantity:

Hyper-V storage best practices

Now that we've covered the technical side of the storage you need for your Hyper-V server and virtual machines, before we finish with this chapter, we will discuss the best practices for Hyper-V storage from the perspective of both Hyper-V as a server side and storage for virtual machines. All these best practices that we will discuss in this chapter come from experience in real-world solution designing and troubleshooting. Choosing a wrong storage layout for your critical virtual workload may end up in your highly utilized workload suffering from performance issues, and if you are going to start your first virtualization project after the completion of this book, I would strongly recommend that you pay serious attention while designing your virtual machine storage selection, because with the wrong start you will face bottlenecks in your server's and application's performance and will also be disappointed in virtualization as a practice and a technology.

Virtual storage is an essential part of a virtual machine; selecting virtual machine storage is mainly based on the type of performance and the agility you need to get from it. Over a period of time, it can be seen that server or virtualization administrators won't give much preference and attention to virtual machine storage. They simply think that if a handsome amount of RAM and virtual CPUs have been allotted to a virtual machine, then that's enough; we can get the best performance from them.

But this is not true; the performance of a virtual machine also depends on the types of storage we make available to the virtual machine because, at the end of the day, a virtual machine works in the same fashion as your physical server, so we should not underrate its importance. There are two elements associated with virtual machine storage; one is the type of virtual storage chosen for the virtual machine, which may or may not be appropriate for the intended use of the virtual machine and its workload, and the second element is the type of storage (VHD/VHDX) on which virtual machine data is stored. If either of these is not adequate to take the load of the disk's I/O requirements, the virtual machine storage gets affected, which consequently reduces the performance of the virtual machine, applications, and users connected to these applications.

Let's go through the best storage practices in the following sections one by one, and understand the importance of proper planning and sizing for your virtual machine storage and its performance problems and troubleshooting for these problems.

Dynamic disks are not good candidates for high disk I/O activity

Creating a new virtual machine from Hyper-V Manager, where a given virtual hard disk is created by default, only provides a dynamic disk based virtual hard disk. And if this new machine is going to be a production virtual machine with a disk-intensive application running on it, we would face performance issues with the disk subsystem.

It is strongly recommended, from both theory and real-world experience, that all critical virtual machines, especially ones that mostly get hit by end users for high disk I/O requirements, be created on a fixed disk based VHD/VHDX. When we create a fixed disk based virtual hard disk (VHD), it occupies the same amount of size as the physical disk of the Hyper-V server. It also allows the virtual machine to better expand the Windows process and handle the virtual storage. A dynamic disk, by its nature, grows when you add more content to it and accommodates the virtual machine's load for its disk I/O requirements while the virtual machine is up and running and doesn't have much room available for both the virtual machine and Hyper-V.

We may close this topic by saying that for any part of the production workload related to storage, we have to either go for fixed disks or pass-through disks. If you had the virtual machine configured with too many snapshots or if the VM was configured for a dynamic disk, we would see a serious performance problem for sure.

Differencing disks can lead to data loss

Differencing disks are special types of disks that are different from virtual hard disks (VHD). They have a different file extension, namely AVHD. Each differencing disk has a parent disk associated with it, and we can have a differencing disk that points to a VHD as its parent disk. Differencing disks build a chain in which many differencing disks are interlinked. Okay, now let's see how differencing disks can lead to data loss; for example, if we have multiple differencing disks interlinked with each other, and between the chain of differencing disks, if we lose any of them, all the data written on that disk will be lost. So they are not recommended for production workloads.

Creating a production virtual machine's snapshot with caution

In the preceding recommendation, we saw how differencing disks can lead to data loss; now we will understand what dangers are associated with creating a virtual machine's snapshot for production workloads. Snapshot is a utility in Hyper-V that allows us to create a snapshot or hot backup of a virtual machine at a certain point, which allows us to restore a virtual machine to the same point in time when we created the snapshot.

Let's say you created a virtual machine and installed the operating system; now before you go ahead and install a custom-made application for your finance department, you can take a snapshot of this virtual machine and then install your custom-made financing application. So later on if you find that there is a problem and you need to reinstall the operating system and all the prerequisite software, all you need to do is to restore the snapshot you took before the installation of the custom-made finance application. So without reinstalling everything, you can get the same virtual machine state as when you created the snapshot.

So when we create a snapshot, Hyper-V stops writing to the VHD (parent virtual hard disk) of a virtual machine and creates a new differencing disk with an extension of AVHD, which is a dynamic disk in nature; so from now on whatever data and changes we make to the virtual machine will be stored here on the AVHD. If you take more snapshots of the virtual machine, more AVHDs (differencing disks) will be created and interlinked to each other.

So the problem here is that, first of all, creating a snapshot of production workloads is not a recommended practice, because creating a snapshot stops the use of the original storage of the virtual machine. Let's say that you planned and used good storage for your virtual machine, which provided you with good disk I/O; after creating a snapshot, Hyper-V will stop using your SAN storage or fixed disk and will start writing on these newly created differencing disks, which are dynamic disks in nature and slower than your fast storage.

If you have multiple snapshots, and eventually multiple differencing disks, your virtual machine data will get stored on multiple differencing disks and these disks will be interlinked to each other. So if any differencing disk in the middle of the chain gets corrupted or if you lose it, you will lose all the data that was written on that disk or during that time span when you created the missing AVHD (differencing disk) snapshot.

So with all the information provided here about differencing disks and the snapshot, we recommend keeping the creation of snapshots for the research and development (RnD) aspect of your applications.

Pass-through disks are recommended for databases

If your virtual machine is going to have a database, such as Exchange Server or SQL Server, keeping the database and transactional logs on a pass-through disk is recommended. Because of the nature of pass-through disks, they are more reliable and have faster media access storage as compared to traditional, file-based virtual storage.

Pass-through disks are usually provided to the Hyper-V server from external storage providers, such as SAN, NAS, or DAS. These external storage providers have a number of disks installed onto them and thus provide a greater level of fault tolerance and faster disk I/O.

So using pass-through disks is the best practice for a database server, file server, or any other type of virtual machine that you consider critical and that you think requires fast data retrieval for its users, and it is recommended that you configure the virtual machine to have access to a pass-through disk. You can configure passthrough and VHD-based storage in any way you like. For example, if we want to, we can keep the operating system on the VHD disk as part of the local or SAN LUN associated with the Hyper-V server. And in the case of Exchange or SQL database storage, we can place this data on a pass-through disk, which could be the external storage of SAN or DAS disks.

Frequently merging a virtual machine's snapshot

As we said previously, first and foremost we should create a production virtual machine's snapshot only in extreme cases, with caution. And if you create a snapshot of a production virtual machine, it is highly recommended that you merge the snapshot with the parent VHD as soon as you are done with testing or any other purpose that you created it for.

Windows Server 2012 addressed a few of the previous issues that people encountered when using a snapshot of a virtual machine, especially the one where a snapshot can only be restored to a machine in the shutdown state. So now an administrator can perform snapshot restoration even while the virtual machine is up and running. Also, while deleting a snapshot-enabled virtual machine, Hyper-V starts merging the snapshot before it gets deleted from the Hyper-V console.

This best practice will also consolidate your data into one location and provide fast recovery, because if we keep a long chain of differencing disks (that is, many snapshots of the virtual machine), there are chances of losing any of these disks, which may result in loss of data.

Including virtual machine RAM for storage sizing

Over a period of time, I have seen that one mistake people make while sizing their Hyper-V storage is that they forget to keep extra storage available on the Hyper-V server, which is used by the virtual machine for their RAM allocations.

By default if you keep a static RAM of 10,240 MB (10 GB) for a virtual machine, upon invoking the virtual machine, Hyper-V will occupy 10 GB of the physical storage of the Hyper-V server for the virtual machine configuration file, which becomes equal to the virtual memory of the virtual machine.

So the mistake that people mostly make is to add only this extra amount of disk storage needed to run the virtual machine on the Hyper-V server. Creating a larger RAM-based virtual machine requires a large amount of free disk space on the Hyper-V server. So the best practice is to always add the virtual machine's RAM size to the total size of the virtual machine storage required, including the virtual storage of a VM.

External storage migration and Hyper-V pass-through disk availability for VM

Sometimes there may be situations where a storage administrator has to perform the migration of SAN LUNs assigned to various servers, including the Hyper-V server. In this type of situation, we have seen instances where people don't have the documented order and LUN assignment for the virtual machine's pass-through disk. And in the event of configuring a wrong pass-through disk, assigning it to the virtual machine may cause the application running on the virtual machine to not work properly.

For all the best practices for such migration on the SAN and Hyper-V server, I have documented a detailed, knowledge-based article on my blog that I would recommend you all to go through, to see all the information you need to know about these types of planned activities.

The following is the URL of my blog post for the SAN storage migration of a virtual machine that has a pass-through disk configured:

http://zahirshahblog.com/2012/01/04/best-practices-for-migratinghyper- v-storage-san-luns-for-microsoft-exchange-server-2010- recommendations-for-migrating-san-luns-for-hyper-v-server-whereexchange- server-2010-vms-are-using-pass/

Virtual machine application and server role placement – best practices

This is a general best practice; here it is always recommended to separate the same application and server roles on different hypervisors and storage. Keeping both VHDs of the same type on the application server's virtual machine may be thought of as keeping all the eggs in the same basket.

Summary

After you complete this chapter, you should understand what virtual machine storage is and what types of virtual machine storage options are available with the Microsoft hypervisor (Hyper-V). We also discussed numerous new virtual storage features added in Microsoft Windows Server 2012 Hyper-V. These new features allow you to use the file server for virtual machine storage and virtual Fibre Channel for virtual machine clustering.

We then covered all the types of virtual machine storage, right from the virtual machine hard disk (VHD) to pass-through disks. We also saw the Hyper-V virtual machine storage settings that allow you to customize the virtual machine's storage settings as per your needs, where we saw the IDE and SCSI controllers for your virtual machine storage. We then covered the two types of utilities, namely edit disk and inspect disk, that come with Hyper-V for virtual machine storage troubleshooting. These two wizard-based utilities provide a handy way for administrators to troubleshoot virtual machine storage and are your toolboxes for compressing and expanding the VHD.

Before finishing with this article, we covered the best practices for virtual machine storage, where we mentioned a number of best practices and recommendations for virtual machine storage with reference to the problems related to virtual machine storage. All these best practices will help you choose the correct virtual storage for your VMs.

Resources for Article :


Further resources on this subject:


About the Author :


Zahir Hussain Shah

Zahir Hussain Shah, a Microsoft Most Valuable Professional, has worked with businesses from small to medium sized organizations to gigantic multi-national companies, providing IT consultancy and solution delivery. He has been in the IT industry for over 7 years now. Currently he is working with UAE’s prestigious oil and gas sector for providing solution designing and delivery for Microsoft Hyper-V, Clustering, Active Directory, Exchange Server, Lync Server, and System Center.

He has also been honored with the industry’s most prestigious Microsoft Most Valuable Professional (MVP) Award in the year of 2011/2012, for his excellent contribution to the Microsoft Server Systems Technical Communities. Apart from the daily office life, Zahir is an author, public speaker, and a blogger, who owns a successful blog (http://zahirshahblog.com) focusing on Microsoft Private Cloud, Messaging, Unified Communications, and Systems Infrastructure solutions. He is also certified for CISSP, MCSE, MCITP, MCTS, and CCNA certifications.

Books From Packt


Instant Hyper-V Server Virtualization Starter [Instant]
Instant Hyper-V Server Virtualization Starter [Instant]

Citrix XenDesktop 5.6 Cookbook
Citrix XenDesktop 5.6 Cookbook

Windows Server 2012 Automation with PowerShell Cookbook
Windows Server 2012 Automation with PowerShell Cookbook

PowerShell 3.0 Advanced Administration Handbook title=
PowerShell 3.0 Advanced Administration Handbook

Windows Server 2012 Hyper-V Cookbook
Windows Server 2012 Hyper-V Cookbook

VMware View 5 Desktop Virtualization Solutions
VMware View 5 Desktop Virtualization Solutions

VMware ThinApp 4.7 Essentials
VMware ThinApp 4.7 Essentials

MVVM Survival Guide for Enterprise Architectures in Silverlight and WPF
MVVM Survival Guide for Enterprise Architectures in Silverlight and WPF


Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software