Tuesday, May 15, 2012

Estimating space for Hyper-V snapshots

A forum post inspired me to not directly answer a question this morning, but rather explain something so that folks can think about it instead.

The original post asked the following:

3 nodes Windows server 2008 R2
I have 3 nodes Hyper-V Cluster CSV in fiber channel with a multiple volumes.
1.What the amount of free space, I should keep the volume csv not to fail for lack of space.
2. Can I create a new volume and configure snapshots to be saved only in this new volume?
3. What is the recommended size for the other volume to store the snapshots.

I see two ways to answer this -

  1. directly answer question #2 and wait for the individual to fail
  2. Attempt to answer #1 and #3 (which estimation here is nearly impossible – due to chaos and randomness).

I jumped straight to a description of the technology – which I have not blogged about for some time, but it just seems to linger.

Here is my response:

You as asking questions about how to size a snapshot volume as if you have a background with ESX / VMware.

A snapshot is a moment in time - a differencing disk and configuration. Not a location where copies of VMs are saved off to.

The disk portion of a snapshot uses a differencing disk. Each differencing disk has the potential to grow to the full size of its parent. If its parent is a fixed disk, it will get that big - if it is a dynamic disk it can reach the maximum.

So, in theory - one snapshot can double the amount of storage required for a VM.

Also, a snapshot location is a runtime location. Where the snapshot is located is where the VM is now running from - until that snapshots is deleted and the snapshot is merged back in.

Knowing this, don't plan on using a slower or different class of storage - unless you are very specific and consistent about how you use snapshots and take this into consideration.

By default snapshots are in the same location as the VHD (and as the VM) - Hyper-V (the product) implemented this model with the R2 release because folks were getting into all kinds of trouble by separating the VM snapshots from configuration from VHD and when it came time to upgrade storage or migrate the VMs wound up broken.

So, you can separate the locations, but you need to be clear on how that benefits you. It is more about your process and procedure than the technology.

You might find this useful: http://itproctology.blogspot.com/search?q=snapshot

On a side note:

There is a growing swell in the Hyper-V forums of questions where folks just want to do something but are not taking the time to understand the implementation, they just push on and have problems.  Back in the day we used to refer to this as RTFM.  But you can’t say that in a forum.  But I plead with you, read the manual.

Thursday, May 10, 2012

Works on MY cloud

For the current shift to the ‘cloud’ I have found it necessary to update the classic “works on my computer” badge.  (I have been threatening to do this for a long time)

Many of us in the software business are very familiar with the classic response to a bug of:  “No Repro” or “Not Reproducible”

There are many reasons for these types of answers, but the most common is that I am not the developer and I am not running the software on his machines or in the same way that she did.  This resulted in the classic “works on my machine”:

WorksOnMyMachine

For the cloud era these applications are generally part of a large distributed system and that is what we are testing – many moving parts, many roles, many different systems.  Errors happen all over the place.  And everything is now a cloud.

So, my proposal has been to update the classic badge of jest to the cloud era and the “Works on my cloud” is born:

WorksOnMyCloud

Wednesday, April 25, 2012

Setting custom DNS settings with PowerShell in Server 2012

Okay, the time has come, I can finally say; “Server 2012”
I frequently use custom DNS settings in my lab environments to override the provided DHCP settings and use my own personal domain controllers.
For Server 2008 I used the following commands:
netsh interface ipv4 add dnsserver "local area connection" x.x.x.x 1
netsh interface ipv4 add dnsserver "local area connection" x.x.x.x 2
For the Windows 8 Preview I simply adapted this:
netsh interface ipv4 add dnsserver "Wired Ethernet Connection" x.x.x.x 1
netsh interface ipv4 add dnsserver "Wired Ethernet Connection" x.x.x.x 2
*Note the change to the interface name
Being an embracer of PowerShell and all the 2000+ new cmdlets in Windows Server I decided to figure out how to do this the PowerShell way.
Well, I have to say it took a while just to find the right cmdlets because I began at IPAddress or IPAdapter.  Not thinking that there would be a DnsClientServerAddress.
Get-DnsClientServerAddress
Now, to set, just turn this around to the Set-
Set-DnsClientServerAddress -InterfaceAlias vEthernet* -ServerAddresses "x.x.x.x","x.x.x.x"
Note how I feed in the multiple addresses, as list of individual comma separated strings.

Then, there is the one-liner (I discuss finding the proper NetAdapter is other posts).

Get-NetAdapter | Set-DnsClientServerAddress -ServerAddresses "x.x.x.x","x.x.x.x"

Monday, April 16, 2012

Windows 8 in a VM on 2008 R2 Hyper-V

Update:  As of October 9, 2012, the update has been superseded by 2744129. Go to http://support.microsoft.com/kb/2744129 to find that update, where it states the supersedence in the documentation.

This is an interesting patch that someone recently pointed me to:  http://support.microsoft.com/kb/2526776
Apply this patch to your Server 2008 R2 Hyper-V Server so that you can install Windows 8 in a VM.
If you do not apply this patch and you attempt to run Windows 8 within a VM: note the symptoms in the KB article:
  • The Windows Developer Preview or Windows Server Developer Preview virtual machine stops responding.
  • The Windows Server 2008 R2 host computer displays a stop error message and restarts automatically. This behavior brings down all other running virtual machines together with the host computer.
That does not sound good.
So, if you have a Hyper-V server that suddenly crashes and reboots, and you know that someone has downloaded the Windows 8 beta and might be installing it into a VM…  Well, you suddenly have an idea what might be going on.

Tuesday, April 10, 2012

PowerShell is about doing things not writing scripts

With PowerShell finally going cross-platform with Windows 8 I keep hearing the same comments over and over – “just write a script for that”

You know what?  Not everything needs a script.  A few commands maybe, but not a script.

Why do I bring this up?  Because script writing is intimidating.  You have to understand loops, arrays, object types, schemas, properties, and other developer-type things.

But if you only have a make a couple modifications to settings, every so often or discover something.  You don’t need a script for that, you need some commands.

And this is where the lingo and the action are becoming disconnected. 

If you look at it one way, PowerShell is to Windows what BASH is to Linux and what Command was to DOS.  A way to get things done.  A place to find things and do things.

Did everything that you did in DOS have to turn into a BATCH script?  No.  But back in the day we did write some pretty complex user logon and logoff scripts.  Why?

Because certain tasks needed to be repeated over and over.  That is where we need a script over a few captured commands.

My other big gripe is script or command examples.  Folks that blog some long and highly complex one-liner that is very difficult to comprehend because you get lost in the pipeline.  The big disservice being that they never do it long hand.

Most folks that I encounter these days are either at the 100 level of using PowerShell or at the 300 – 400 level.  You just straight through the 200 level when you write a script or suddenly grok objects.