I believe in Hyper-V!

VirtualizationCategory Archives

Online VHDX resize [WS2012R2 & W8.1 Preview]

One of the great new features in Windows Server 2012 R2 and Windows 8.1 Preview, actually in Hyper-V role, is online .VHDX resize. What does that mean for us? As headline said, now we have ability to increase and decrease the size of .VHDX files with no interruption of end users services.
NOTE: This new feature is limited to the new .VHDX format and isn’t available for the .VHD format.

As always, I’ll show you how to resize .VHDX in both ways and with many pictures ;)

Choose VM and press on Settings

1

Select Hard Drive/Virtual hard disk and press on Edit

2

Under Locate Virtual Hard Disk window press Next

3

Select Expand and press Next

4

Enter new disk size and press Next

5

Check settings under Description and click on Finish

7

Logon into VM, open Disk Management and you will see Unallocated space

8

Now you can Extend volume to Unallocated space

9

10

And voila. Now we have a bigger disk

11

Ok, through the pictures above we showed how to extend virtual hard drive.

 

Now I’ll show you how to decrease virtual hard disk. Please note that the VM is running all the time!

Open Disk Management on VM, select Shrink, enter the amount of space to shink and click on Shrink.

12

Now we have 26GB of Unallocated/free space on virtual hard disk

13

Open VM setting, go to virtual hard disk and press Edit, than press on Next

14

Select Shrink then press on Next

15

Under Shrink Virtual Hard Disk enter new virtual disk size and press on Next

17

Check description and click on Finish

18

As you can see in the picture below we have smaller virtual hard drive ;) For me personally this is one of the coolest feature in WS2012 R2 Hyper-V, behind USB pass-through, full Remote Desktop, automatic activation of VMs, Gen 2VMs etc…. :)

19

Today is a Friday, the last working day of the week. No big deal, but from today after work I’m on a vacation. In the last eleven months I have worked very hard and now deserve a break/vacation with my family.
Sea, see you tomorrow!

Cheers,

Romeo

Virtual Machine failed to start/create/take snapshot etc…

Few months ago I wrote about issues with virtual machines on my laptop. Also, I had issues with virtual machines on my domain. I would like to explain my environment and what happened with virtual machines on Hyper-V domain member hosts. On each Hyper-V host I have approximately 12-15 VMs with local storage and one System Center SP1 Virtual Machine Manager for management. All VMs run smoothly, but when I need to create new virtual machine, take checkpoint (snapshot), migrate, start, etc… job failed, even I do that through VMM or Hyper-V Manager console. When I restart Hyper-V service on Hyper-V host everything works fine some time, but when you need restart Hyper-V service from time to time, especially if you manage Hyper-V server from VMM or from a central location that can be very annoying. So, where is the catch? (in my case, but I heard that many of my colleagues have same or similar issues.).

One of examples

1

Log on into domain controller, open Group Policy Management and create new Group Policy Object (GPO) under Group Policy Object container. You can call him whatever you want.

2

After you create new GPO click on Edit, new window will appear.

3
4

Now, expand Computer Configuration –> Policies –> Windows Settings –> Security Settings –> Local Policies –> User Rights Assignment. On the right side open Allow log on locally tick on Define these policy settings and Add User or Group. I added Administrators, Hyper-V host administrators and VMM administrator.

5

After you are done, close Group Policy Management Editor and link newly created GPO to the Hyper-V hosts Organizational Unit.

6

On domain controller and Hyper-V hosts open command prompt and type gpupdate /force.

7

We are done!

Enjoy,

Romeo

Hyper-V Replica [test environment]

In one of my latest post I wrote about how to install Hyper-V role inside Hyper-V virtual machine. Many of my colleagues asked me, why you do that? Actually, I have two answers. The first is: I don’t have free hardware in my company for testing purposes, and the second is; for my lectures/demos on various conferences when I talk about Hyper-V Replica (not only about Hyper-V Replica). When I have test environment on my laptop I’m pretty sure that demos will work.
So, let’s go back to the title. In one of my demos I need to do Hyper-V Replica between two Hyper-V hosts and you can see step-by-step guide in the pictures and short explanations below.

1. In this test environment I want replicate VM RHV from Hyper-V host called WD2012CORE to Hyper-V host called Hyper-VReplica. The procedure is straight forward, just follow the wizard :). Select VM which you wont replicate and select Enable Replication.

1
2

Choose on which Hyper-V host you want replicate your VM’s. As I mention before, I replicate from WS2012CORE to Hyper-VReplica Hyper-V host.

3
4

Under the Specify Connection Parameters tab can choose Authentication Type. Be default wizard offers us Kerberos authentication (HTTP), but we can use certificate-based authentication (HTTPS) if we wont secure transmission between Hyper-V hosts. Of course, if you want use certificate based authentication need to have certificate. But considering that this is test environment I chose Kerberos authentication.

5 

On the next tab select virtual disk location and click Next

6 

In my case I chose option Only the latest recovery point, but in production environment we need to have another plan, depends of your needs.

7

When you go to Choose Initial Replication Method can choose three ways how want to transfer initial copy to Hyper-V Replica server. In my case I chose option Send initial copy over the network. For my production environment is very interesting to use option Send initial copy using external media. Why this is a good solution? For example; if have very big virtual machines (I mean on big capacity) than you can send initial copy on an external media (external HDD) and take it to a remote location. In this case, does not overload the network resources if you have slow connection between two locations, like I have.

8

At the end check parameters on Summary and click Finish.
9

Log on Hyper-V Replica server and will see your replicated Hyper-V virtual machine.
10

If you want to check replica status right click on VM and you will be see Replication Health for replicated VM.
11

All above we do through GUI, but I like do that with PowerShell. So, how to replicate VM with PowerShell from Hyper-V host to Hyper-V Replica server you can see below.

PowerShell 3.0 includes 22 Cmdlets for configuring, enabling, monitoring, and managing Hyper-V Replica on an automated basis. This time I’ll be just write PS script for above mentioned example. I one of my next blog post I’ll be describe how to use PowerShell for Hyper-V Replica step-by-step.

So, in this example I replicate virtual machine WinDays13 from Hyper-V host WS2012CORE to Hyper-V host Hyper-V Replica. First I need to enable Hyper-V Replica on Hyper-V host.

1

And the second I need to enable replication for virtual machine.

2

Voila! VM WinDays13 is replicated.

3

At the end of this article I’d like to mention one very important thing! Hyper-V Replica isn’t BACKUP! We use Hyper-V Replica for a DISASTER RECOVERY.

It’s Monday, let’s get to work.

Cheers,

Romeo.