As most of you know, when VMware Consolidated Backup dumps image level backups VCB only dumps used diskspace. Unfortunately for us VCB does this by checking at block level if it contains only zero’s or not. If it contains only zero’s the block is considered empty, but an Operating System doesn’t zero out the disk space that contained the files when a file is deleted. An Operating System only clears the pointers to these files. This is why you could have a disk with only 4GB of used space and a 6GB VCB dump. As of ESX 3.0.2 update 1 VMware reintroduced the shrink option in VMware Tools. Kind of a weird name “shrink” cause the vmdk doesn’t actually shrink, the unused space is just zeroed out.


I tested this and it works great, only downside is that you can’t schedule this shrink tool. Luckily for us there are more tools you can use to zero out your disk and save time writing the dumps to tape / disk and save diskspace. I re-wrote a vbs script, which was originally created by Doug Knox for defragmenting local disks to include zeroing out for every local disk in the server. The script uses the Sysinternals tool Sdelete, download it and copy it to c:\windows\system32\. It defragments the disk and than writes zero’s on all unused space.

sdelfrag.vbs:

Set WshShell = WScript.CreateObject("WScript.Shell")
Dim fso, d, dc
Set fso = CreateObject("Scripting.FileSystemObject")
Set dc = fso.Drives
WshShell.RegWrite "HKCU\Software\Sysinternals\", 0, "REG_SZ"
WshShell.RegWrite "HKCU\Software\Sysinternals\SDelete\", 0, "REG_SZ"
WshShell.RegWrite "HKCU\Software\Sysinternals\SDelete\EulaAccepted", 1, "REG_DWORD"
For Each d in dc
If d.DriveType = 2 Then
Return = WshShell.Run("defrag " & d & " -f", 1, TRUE)'
Return = WshShell.Run("sdelete -c " & d, 1, TRUE)
End If
Next
Set WshShell = Nothing