Wednesday, 10 April 2019

Hyper-V virtual machines in starting state for a long time (Veeam issue)

The Issue

At work we have a two Hyper-V host set up with one live Hyper-V server and one replication server. We run 5 virtual machines on Hyper-V and use Veeam to backup and replicate all the virtual machines.

The last few times that I restarted the main Hyper-V server for windows updates I noticed that the virtual machines took a long time to start up.

The host server restarted as normal but all the virtual machines showed as 'starting...' in Hyper-V Manager with no sign of any of the virtual machines starting up.

After around an hour and a half of waiting all the virtual machines suddenly started up as nothing had happened. When I checked all the virtual machines they were working normally.

I restarted one of the virtual machines to see if the slow start up happened again. This time there was a slight delay of around thirty seconds but nothing as extreme as the first boot. So it looked like it was only an issue when the host server rebooted.

I looked through the event viewer but couldn't see anything regarding the slow boot.

The Fix

After a few hours of search on the internet I finally found an article that looked like it matched my problem. It was from a Veeam forum thread. I contacted my IT support company to get there opinion on the article and they confirmed that I had the same issue.

I have to schedule in an update for Veeam Backup and Replication to Version 9 Update 4

The Problem

The problem of the slow boot was caused by Veeam Backup and Replication 9 not cleaning up replication points correctly in virtual machine configuration files. Hyper-V configuation files with the extension .vmxc are used by Veeam, to temporarily store replication point information. The information should be deleted soon after the relication has completed but for some reason this clean up doesn't happen correct in this version of Veeam Backup and Replication. The .vmcx files should be quite small but in our example they were around 50 mb each. We ran the script to check how many replication points were stored in the files and found it to be an average of 14000 replication points!

We haven't updated Veeam yet but hopefully this should fix the issue. I'll update this article to confirm if the fix works or not.

Wednesday, 22 October 2014

Automate mkdocs html files build process

At work I needed to find a way of writing a lot of documentation easily and quickly. The system was going to be used by technical and non-technical people.

For this I am current looking at a great project called mkdocs. This is a python program that allows for all documentation to be created in markdown syntax and then built into a flat html website.

Markdown is a text to html processor that has an easy to learn syntax . Markdown files can be created in any text editor. So users can be focused on creating documentation rather than getting distracted.

My idea was to allow all user to create documentation and see the changes instantly on the website. mkdocs has a setting that dynamically shows how your pages will look in a browser while creating the documentation source files.

This works great but I needed to be able to build flat html files and copy them to a web server.

Below is the batch file (windows)
REM Automate the build process of creating a website from mkdocs markdown

REM Change to source drive

REM path to docs site to convert
cd X:\DocSource\admin

REM covert to flat html website (this creates a 'site' folder)
c:\Python27\python.exe c:\Python27\Scripts\mkdocs build

REM copy site to web server folder
xcopy site\* c:\inetpub\wwwroot\admin\* /s /e /y
This can run on a schedule or even could be set up to run when something changes in the document source location.

Tuesday, 8 July 2014

Using Mozilla Webmaker to create a map of all Gurdwaras (Sikh Temples) in Bradford, UK

I have created a map of all the Gurdwara Sahibs in Bradford. It uses leaflet.js and openstreetmap for the mapping. It was all created in Mozilla Thimble which allows for easier javascript and html editing through an online editor.

Monday, 7 July 2014

Geocoding address data in Excel using google Geocoding API

I had a long list of addresses that I needed to show on a map. I found a great article that showed exactly how to call googles geocoding mapping from Excel.

The only issue I had was that Googles API doesn't like it if too many requests are made too quickly so I created a function to add the geocoding calculation into a column one cell at a time and waiting one second between calls.

Below is the function

Sub Geocoding100()
    Dim I
    For I = 1 To 100
        ActiveCell.FormulaR1C1 = "=GoogleGeocode(RC[-1])"
        ActiveCell.Offset(1, 0).Select
        Application.Wait (Now + TimeValue("00:00:01"))
        Next I
End Sub
I can leave this function running in the background to geocode a list of addresses in excel and I am not hammering Google Geocoding API.

Its a win win situation!

Tuesday, 3 December 2013

Hyper-V 2012 R2 Export / Backup Script

Our backup tool of choice for our virtual infrastructure is Acronis Backup and Recovery Virtual Edition 11.5. However recently we had issues with it on our new Hyper-V 2012 R2 Servers.

We needed some backups while we fixed the issues with Acronis so I created this powershell script to export all the vms on each of our Hyper-V servers.

The script loops through all virtual machines on the local Hyper-V server and exports the virtual machine to the backup location specified in $path. The exported files are stored in a folder named with todays date inside a folder with the name of the virtual machine.

Example \\[path backup location]\testVM\2013-12-03\

--Start of script--

$path = ""
$vms = Get-VM
foreach ($vm in $vms) {
    $date = Get-Date -format “yyyy-MM-dd”
    $vmname = $vm.Name
    New-Item -ItemType Directory -Path $path\$vmname\$date -Force
    Export-VM -Name $vmname -Path $path\$vmname\$date\

--End of script--


This script has only been used on Hyper-V 2012 R2 servers as this version allows virtual machines to be exported while the virtual machine is running.

I have had to run the script on the local Hyper-V server. It doesn't work when ran from a remote console.

As with any script please test it before using in production as there is no warranty with this script.

Hope it helps some one.