Using SDelete to maximise the amount of disk space reclaimed during conversion to thin-provisioned disks

10.28.2009

We’re currently neck-deep in migration at the moment, but despite the workload, it’s always worth considering what we can do now, that might save us some time and effort later on.

One of the reasons we were moving to vSphere was the ability to thin-provision (TP) our disks, which we’re hoping will allow us to increase the amount of machines that we can provision without needing to allocate more storage (currently 18 TB).  I found an article by Duncan Epping over at Yellow Bricks suggesting the use of Sysinternals SDelete utility before the conversion to TP.

Essentially, as deleted files are not zeroed in Windows, and because VMware looks at the raw disk when “deallocating” space during conversion to think provisioned disks; deleted data are not reclaimed.  Running SDelete in the Windows guest before converting the disk to thin provisioned format zeroes the deleted data and should allow the maximum amount of space to be reclaimed.

While I don’t doubt that this is all correct, I wasn’t sure how much extra space it would allow us to reclaim. The majority of our guests are relatively small windows clients, almost all of which have non-persistent hard drives; of course – once they’ve been made non-persistent, the drive is effectively frozen, and subsequent use won’t increase the amount of non-zeroed slack space.

What’s the best way to see whether this is worthwhile? Run an experiment of course!

Method

I took one of our standard Windows XP guests which had been migrated to the new vSphere infrastructure. It had a 10GB hard drive, currently persistent, but which has been – for the majority of it’s 9 month existence – non-persistent. I examined how much disk space it was using, this was the pre-TP “Control”. I then cloned it without customization. One of the clones was converted to TP during a Storage vMotion operation. The other had slack space zeroed using SDelete (this process took around 3 minutes). It was then converted to Thin Provisioned disk format using Storage vMotion in the same way as the first machine.

Results

Here’s what happened

Normal (Thick) Disk

  • Provisioned Storage: 10.50 GB
  • Not-shared Storage: 10.00 GB
  • Used Storage: 10.00GB

Converted to Thin Provisioned

  • Provisioned Storage: 10.50 GB
  • Not-shared Storage: 5.05 GB
  • Used Storage: 5.05 GB

Converted to Thin Provisioned, after running SDelete

  • Provisioned Storage: 10.50 GB
  • Not-shared Storage: 4.21 GB
  • Used Storage: 4.21 GB

Conclusion

Zeroing slack space on this typical machine saved me 0.84 GB (8.4%). For the minimal effort involved, I think this is worthwhile (I have about 500 more machines almost exactly the same as this).

The percentage of free space reclaimed would likely be higher on persistent machines, or larger machines which see frequent creation and deletion of files.

XtraVirt’s vAlarm

10.14.2009

I’ve been trying out XtraVirt‘s vAlarm:-

vAlarm is a Windows® based application which monitors alarms generated by VMware® vCenter.

The product is designed to be installed on an administrators PC, and provides automated monitoring of vCenter alarms without needing to be logged into a full VI Client console.

The software automatically communicates with a vCenter server on a user configurable schedule, and notifies any active alarms via a popup information bubble in the notification area of a users desktop.

The option to show details of all active alarms displays an information dialogue which lists individual alarms with detailed descriptions.

The software supports VMware vCenter 2.5 & 4.0.

It’s turned out to be quite handy, as it’s making me far more conscious of alarms. It might even encourage me to modify the default set of alarms – I’m generally not interested in guests going into the red because of CPU or memory due to the nature of the way they’re used, but I do need to know when hosts and datastores are running close to capacity.

The system tray application pops up a bubble, even when there are no alarms, which isn’t strictly necessary, and it might be nice to be able to collate notifications from more than one vCenter Server (I’m currently watching over two); but these are minor quibbles about a free product.

You can download vAlarm from XtraVirt (free registration required).

vCenter and Host Build Numbers

10.02.2009

This is based on Carter Shanklin’s PowerShell snippets to query VC and ESX build version numbers.

This script loops through the list of vCenter servers, and gets their version and build info, as well as the version and build info for it’s connected hosts.

# Script to connect to a list of vCenter Servers, and get their version numbers, as well as the version numbers of their hosts
# Ben Neise
# 02/10/09
 
# Array of vCenter Servers
$arrVCenterServers = @("server1","server2","server3")
 
# Create empty arrays for the results
$arrTableVCs = @()
$arrTableHosts = @()
 
# Loop through the array of vCenter servers specified above
ForEach ($strVCenterServer in $arrVCenterServers){
	# Connect to the VC
	$objVCenterServer = Connect-VIServer $strVCenterServer
	# Version info about the VC you are connected to
	$viewVCenterServer = Get-View serviceinstance
	# Add custom attributes to each VC objects for version and build
	$objVCenterServer | Add-Member -Name Version -type noteproperty -value ($viewVCenterServer.content.about.Version) -Force
	$objVCenterServer | Add-Member -Name Build -type noteproperty -value ($viewVCenterServer.content.about.Build) -Force
	# Add the VC object to the results array
	$arrTableVCs += $objVCenterServer
	# When connected to loop through the hosts managed by the VC
	ForEach ($objHost in (Get-VMhost | Sort-Object)){
		# Get the view for the current host
		$viewHost = $objHost | Get-View
		# Add custom attributes to the host object for VC server, Host and Version
		$objHost | Add-Member -Name VCServer -type noteproperty -value $objVCenterServer.Name -Force
		$objHost | Add-Member -Name Host -type noteproperty -value $viewHost.Name -Force
		$objHost | Add-Member -Name Version -type noteproperty -value $viewHost.Config.Product.Version -Force
		# Add the host object to the results array
		$arrTableHosts += $objHost
	}
	# Disconnect from the VC server
	Disconnect-VIServer -Confirm:$False
}
# Output the VC results (can be modified to output to a CSV with Export-CSV)
$arrTableVCs | Select-Object Name, Version, Build | Sort-Object Name
 
# Output the Host results (can be modified to output to a CSV with Export-CSV)
$arrTableHosts | Select-Object VCServer, Host, Version, Build | Format-Table
 
# End of script

Script to add VMX path as a custom attribute

09.15.2009

I love it when I have an idea in my head of a script I need to write, and then I run across one that does exactly what I need!

Hugo Peeter’s has written a script to add VMX location as a Custom Attribute:

Add Vmx Path to VI Client using Powershell | PeetersOnline.nl.

Understanding Memory Resource Management in VMware ESX Server

09.15.2009
RAM

Photo from Flickr, courtesy C Wood

VMware have published an excellent white paper on memory management [pdf].

The document is technically detailed, but makes interesting reading. The authors do a good job of describing the methods ESX uses to manage and allocate virtual memory; and how when guests deallocate memory it’s not necessarily freed up for reuse by other guests. This should prevent you from allocating more memory to guests than is physically available on the host (overcommitting); however the hypervisor uses three memory reclamation strategies which allow overcommitment:-

  • Transparent Page Sharing (TPS). Where ESX detects that multiple guests are using identical memory pages (such as those used by common OS components), it presents one shared copy to the guests. By default, this is active all the time. If the guests need to write to the memory, a copy needs to be made, which incurs a slight performance penalty.
  • Ballooning. Is where VMware tools allows the hypervisor to see inside the guest operating system and reclaim unused memory. This typically occurs when ESX drops to less than 4% free memory (the Soft threshold). It has more of an overhead than TPS, but is still preferable to the alternative.
  • Hypervisor swapping. This is used as a last-resort when TPS or Ballooning cannot provide enough memory (or cannot provide it quickly enough). Swapping tends to affect the guest more than the other two methods.

In the unlikely event that Hypervisor Swapping is unable to provide enough memory to meet the requirement, the hypervisor blocks the execution of all virtual machines which exceed their memory limit.

The whitepaper details the results of various benchmarks to evaluate the performance overhead of each of the reclamation strategies. While I’d certainly heard that the performance impact of TPS was negligible, I had always been slightly sceptical, but the data provided by VMware would appear to back it up.

The whitepaper also includes some best practices for memory management, some of which have had me thinking about our memory allocation strategy:-

  • Do not disable page sharing or the balloon driver. These two techniques are enabled by default in ESX4 and I can’t imagine that anyone would disable them unless they had specific reason to. It’s also another reason to make sure you have VMware tools installed on all your guests.
  • Carefully specify the memory limit and memory reservation. Our environment is pretty fluid, with a large number of small guests with 10-15% of them being . For this to be useful for us, these values would need to be constantly checked and reconfigured.
  • Host memory size should be larger than guest memory usage. I generally try to limit our hosts to a 20% potential overcommit on RAM allocated to guests, and as there are usually only about 80% of our machines switched on at any one time, the hosts are normally pretty comfortable. However, this conservative approach means our RAM allocations need to be carefully managed, and kept as low as possible; which may be hitting us elsewhere (see below)
  • Use shares to adjust relative priorities when memory is overcommitted. Our environment is pretty unique in that the vast majority of the machines have equal priority, so there’s little need for us to add another management overhead.
  • Set appropriate Virtual Machine memory size. The virtual machine memory size should be a little larger than the average used by the guest. I think this is an area we need to look at in our environment. Our default RAM allocations for guests is probably a little on the low side, due to historical reasons, and due to our current environment being configured with a  rather paltry 16GB of physical RAM (a problem that will be resolved in the next couple of months). We may be keeping our memory usage in check, but the resultant disk-swapping might be stressing our storage infrastructure.

The white paper is definitely worth reading; it’s certainly going to help me plan a memory management strategy for the implementing our infrastructure on the new hardware .

Training resources for VCP on vSphere 4.

09.14.2009

Vladan Seget has posted some links to training resources for VCP on vSphere 4.

It doesn’t look like I’ll have time to do the upgrade course this year, which means, as a VCP ion VI3, I won’t be eligible to bypass the “What’s New” course (see below).

VCP on vSphere 4, Certification Paths

VCP on vSphere certification now available

08.12.2009

The VCP on VI4 certification is now available.

Registration for the VCP4 exam will open on August 14th. The first exam date available will be August 25th.

Export and import customization profiles using PowerShell

07.09.2009

I’m in the middle of preparing for a migration from VI3 to vSphere 4 just now (hence the lack of substantial updating on this site).

As part of this process, I was just about to start writing  a script to export our customisation specifications, when Arnim van Lieshout’s post appeared in my VMware Planet V12N RSS feed.

Export and import customization profiles using Powershell | Arnim van Lieshout.

It failed on a couple of customisations, but by adding…

Write-Host Exporting $CustomizationProfile.name

…after the ForEach loop started, it was easy to see that it was customisations with “/” and “*” characters that were causing the errors.

VMware Developer CodeCentral

06.24.2009

VMware have launched a new community site for code examples, and there’s a section on VMware vSphere PowerCLI (formerly VI Toolkit).

They seem to be picking the best scripts from the regular contributors to the forums, so it’s a good place to have a look for examples. They’re rated by users, and tend to be slightly better documented than the ones posted in the forums (which tend to be appended and amended as the thread progresses).

I/O Queues, “micro-bursting”, and Multipathing

06.23.2009

Virtual Geek has an interesting article on VMware I/O queues, “micro-bursting”, and multipathing.

Looks intimidating at first glance, but it’s suprisingly straightforward.

« Previous PageNext Page »