posted on Wednesday October 29, 2008 - 10:59 am (3 weeks, 1 day ago)
tags , , ,

When we went overseas last year, I took a GPS Datalogger unit with me. Upon our return, I downloaded the tracks of our adventure but the software was unable to handle over 130,000 points of data to process it correctly.

Fast forward to a year later and there are still tracks from last year on the GPS unit. I downloaded what was available (around half of the data from our trip) and cleared all the data. Except now I’m unable to find the original download I made, which is extremely disappointing. The software, however, has matured and is quite capable of processing a large number of points.

To give the software a test drive, I made sure the unit was in my pocket all day yesterday. I was a bit busier than usual so it made a great test. One of the software’s great features is it’s ability to plot onto Google Maps, which is the map I’ve included alongside this post.

Some stats from the data generated:

  • The points were generated over a period of 13 hours, 22 minutes.
  • There are 15085 data points recorded.
  • I traveled 316.79km.

The unit also records heading, speed and altitude as well as longitude and latitude, which means it also has the ability to plot correctly onto a 3D map such as Google Earth. If all goes will this time, hopefully I’ll have proper tracks of the paths we travel!

No comments, make a comment »
posted on Friday October 10, 2008 - 1:59 pm (1 month, 1 week ago)
tags , , , , ,

Since we have a standalone VMWare ESX Server, we’re not using the consolidated backup (which doesn’t really sound like it would achieve what I want in a backup system anyway). Instead, every night I export all of the Virtual Machine disk and configuration files off to another server.

This way, if the ESX Server and it’s storage cluster completely fails, it is a simple task to rebuild the server and recover the disk images. It is an unlikely occurrence, especially if you’re using external storage such as a NAS or SAN device, but it might just save my bacon.

The script that I use to backup the virtual machines is good. It creates a snapshot of any virtual machine and then exports that snapshot to disk. The problem with the script is that it doesn’t always delete the snapshot even though it’s supposed to. Then, when it next attempts to backup a virtual machine it fails as the existing snapshot conflicts.

So, I came up with a small script to remove and consolidate all snapshots for each running virtual machine prior to the backup. Since I’ve implemented this script to run before the backup script, the problem has gone away. Note that this script is intended to run on VMWare ESX Server 3.5 and is unlikely to work on 3.5i as it does not have the Linux interface. It may work on older versions of ESX Server but it may require some minor changes to do so.

I’ll explain the script bit by bit:

for virtualMachine in $(/usr/bin/vmware-cmd -l)
do
	...
done

This do loop runs through all of the virtual machines that are found by the list command. Next, only limit ourselves to virtual machines that are running (you could skip this step if you wanted to remove snapshots from all virtual machines):

if /usr/bin/vmware-cmd $virtualMachine getstate | grep -q "on"
then
	...
fi

The if statement queries the ESX server to see if the virtual machine is running. If it is running, we’ll next check if it has any snapshots we want to consolidate and remove:

if /usr/bin/vmware-cmd $virtualMachine hassnapshot | grep -q "1"
then
	...
fi

The final thing to do is to actually remove the snapshots:

/usr/bin/vmware-cmd $virtualMachine removesnapshots

Putting it all together, our script looks like this:

for virtualMachine in $(/usr/bin/vmware-cmd -l)
do
	if /usr/bin/vmware-cmd $virtualMachine getstate | grep -q "on"
	then
		echo $virtualMachine is running...
		if /usr/bin/vmware-cmd $virtualMachine hassnapshot | grep -q "1"
		then
			echo $virtualMachine has a snapshot, removing...
			/usr/bin/vmware-cmd $virtualMachine removesnapshots
		else
			echo $virtualMachine has no snapshots.
		fi
	fi

	echo
done

It’s a pretty simple script which you could possibly tart up by logging to /var/log/ or somewhere else. You could even have it email you with the results. For our purposes, though, it’s worked a treat and was a fun re-introduction into shell scripting since I haven’t done it for years.

No comments, make a comment »
 
bludger.org (version 9) © 2000-2008 bludger.org. All rights reserved.
Not many animals were harmed in the making of bludger.org, but a lot were eaten. And they were delicious.
I mean, really, really nice. I especially liked the squab, he didn't put up a fight.