GetVirtual – Virtualization 4 All

My vision what Microsoft Virtualization and Cloud Computing bring to IT World

Tag Archives: VHDX

Configuring a Shared Virtual Hard Disk

Starting in Windows Server 2012 R2 Preview, Hyper-V makes it possible to share a virtual hard disk file between multiple virtual machines. Sharing a virtual hard disk file (.vhdx) provides the shared storage that is necessary for a Hyper-V guest failover cluster.

Using a shared virtual hard disk is ideal for the following situations:

· SQL Server database files.

· File server services running within a virtual machine.

· Database files that reside on shared disks.

Create and enable a shared virtual hard disk on a virtual machine

Open Hyper-V Manager if it is not already open. (From Server Manager, click Tools and then click Hyper-V Manager.)

Under Virtual Machines, select the virtual machine that you want to configure with a shared virtual hard disk..

In the Actions pane, click Settings.

clip_image002

Click SCSI Controller.

On the left pane, under SCSI Controller, click Add.

clip_image004[4]

On the left pane, under Hard Drive, click New to start the New Virtual Hard Disk Wizard..

clip_image006

On the Before You Begin page, click Next

clip_image008

On the Choose Disk Format, accept the default VHDX. Click Next.

clip_image010

On the Choose Disk Type Page, accept the default Dynamic Expanding. Click Next.

clip_image012

On the Specify Name and Location page, enter the name of your shared virtual hard disk..

On the Specify Name and Location page, click Browse. Navigate to your shared storage location. (Cluster Shared Volumes (CSV) or on a Scale-Out File Server Cluster with SMB 3.0). 

Click Select Folder. Click Next

clip_image014

On the Configure Disk page, verify the size of the new virtual hard disk and alter to desired size or accept default. Click Next

clip_image016

On the Completing the New Virtual Hard Disk Wizard, review your configuration and Click Finish

clip_image018

The new virtual hard disk is now created and needs to be enabled as a shared virtual hard disk. Click the Hard Drive you just created under SCSI Controller

Click the “+” symbol next to the hard disk. 

clip_image020

Click Advanced Features.

On the right hand size, under Virtual hard disk sharing, click Enable virtual hard disk sharing

Click OK. The shared virtual hard disk is now created and enabled. 

Resuming

Sharing a virtual hard disk file (.vhdx) means that you can create and manage a guest failover cluster to protect the application services running inside your virtual machines. Before Windows Server 2012 R2 Preview, if you wanted to create a Hyper-V guest failover cluster, you needed to expose your storage topology to the virtual machine.

Starting in Windows Server 2012 R2 Preview, you can deploy a Hyper-V guest failover cluster that is no longer bound to your storage topology. You can implement a guest failover cluster by using a shared virtual hard disk, Fibre Channel, Server Message Block (SMB), Storage Spaces, or iSCSI storage options. Shared virtual hard disks are only available in Windows Server 2012 R2 Preview. Hyper-V makes it possible to share a virtual hard disk file between multiple virtual machines. Sharing a virtual hard disk file (.vhdx) provides the shared storage that is necessary for a Hyper-V guest failover cluster.

Cheers,


Marcos Nogueira
http://blog.marcosnogueira.org
Twitter: @mdnoga

Resizing a virtual hard disk with Windows Server 2012 R2

Starting in Windows Server 2012 R2 Preview, Hyper-V delivers the ability to expand or shrink the size of a virtual hard disk while the virtual machine is still running.

Storage administrators can avoid costly downtime by performing maintenance operations on running virtual hard disks. Shutting down virtual machines is no longer required and this eliminates interruption to users accessing those virtual machines and helps reduce maintenance costs. Prior to Windows Server 2012 R2 Preview, if a virtual machine was online or a virtual hard disk was in use, it was not possible to perform maintenance on the virtual hard disk without temporarily shutting down the virtual machine.

Requirements

The following functionality is required for resizing a virtual hard disk:

· A server capable of running Hyper-V. The server must have processor support for hardware virtualization. The Hyper-V role must be installed.

· A user account that is a member of the local Hyper-V Administrators group or the Administrators group.

The following functionality is required for resizing a virtual hard disk:

· VHDX – the ability to expand and shrink virtual hard disks is exclusive to virtual hard disks that are using the .vhdx file format. Online resizing is supported for VHDX disk types, including fixed, differencing, and dynamic disks. Virtual hard disks that use the .vhd file format are not supported for resizing operations.

· SCSI controller – the ability to expand or shrink the capacity of a virtual hard disk is exclusive to .vhdx files that are attached to a SCSI controller. VHDX files that are attached to an IDE controller are not supported.

Understanding online resizing functionality

There are important concepts to understand when increasing or decreasing the capacity of a virtual hard disk.

Expanding a virtual hard disk

Expanding a virtual hard disk increases the disk capacity of the virtual hard disk. However, to make the additional disk space available to the virtual machine requires some extra configuration. From the perspective of the virtual machine, the virtual hard disk expansion is reflected under Disk Manager as an unallocated disk volume. The size of this unallocated volume is the difference between the original virtual hard disk and the nominated size of the expanded virtual hard disk.

To make the full virtual hard disk capacity available to the virtual machine, you need to use Disk Manager to expand the volume within the virtual machine. You can do this by using the Extend Volume Wizard within Disk Manager. After this is complete, you will be able to view the expanded disk capacity in the operating system of the virtual machine.

Shrinking a virtual hard disk

As expected, when you shrink a virtual hard disk, the virtual hard disk capacity is decreased. However, there is a limit to amount of disk space that can be adjusted when you shrink a virtual hard disk. That limit is defined by the size of the volume that is currently in use by the virtual machine. The Hyper-V Manager user interface shows the minimum disk size available for shrinking a virtual hard disk.

If you want to shrink the size of the virtual hard disk below the size of the currently used volume within the virtual machine, you must first use Disk Manager in the operating system of the virtual machine to shrink the volume. After that is complete, you can reduce the size of the virtual hard disk.

Performing online resizing operations

In Windows Server 2012 R2, the option to resize a virtual hard disk is available through the Edit Virtual Hard Disk Wizard. However, the user interface option to shrink a virtual hard disk is only visible for virtual hard disks that have been previously expanded.

Administrators can use the Windows PowerShell interface for online virtual hard disk resizing operations. This can be done by using the Resize-VirtualDisk cmdlet.

Cheers,


Marcos Nogueira
http://blog.marcosnogueira.org
Twitter: @mdnoga

How does a storage migration of a running virtual machine in Windows Server 2012 (both through Hyper-V manager and through PowerShell) actually work?

The process followed by Hyper-V internally to perform a storage migration is actually quite simple to explain and is as follows:

Step 1: Start with a virtual machine that is reading and writing to a virtual hard disk file (.VHDX in the diagram, but storage migration is supported for both .VHDX and .VHD files).

Step 2: After the user selects to perform a storage migration, immediately create a new virtual hard disk in the requested destination. Continue to read and write to the source virtual hard disk – but any new write operations are also mirrored to the new virtual hard disk.

Step 3: Perform a single pass operation to copy the data from the source virtual hard disk to the destination virtual hard disk. While this copy is happening, it still continues to mirror writes to both disks. It also keep track of uncopied blocks that have already been updated through a mirrored write – and make sure to not needlessly copy that data again.

Step 4: Once the copy operation is complete – it switch the virtual machine to be running only on the destination virtual hard disk.

Step 5: Delete the source virtual hard disk and the migration is now complete.

One important note to make here – Microsoft are very careful to not delete the source virtual hard disk until after the virtual machine is successfully running on the destination virtual hard disk. This way if there is an error at any point in the storage migration – we can always fail back to running off of the source virtual hard disk.