I was just reading up on my Google Reader. A lot of information been dropped over the last couple of days and more and more people are getting active on the VMware blogoshere. One of the articles that really caught my attention was the “VM Template best practices (Linux)” by Leo Raikhman.
Leo did a great job in explaining how to build up a decent Template. Leo even included a way to regularly zero out the Linux Filesystem for the purpose of VCB image level dumps with small footprints.
And although Leo’s article talks about Linux only this also applies for Windows. If you will be doing VCB then remember to zero-out your filesystem every once in a while. Linux doesn’t scrub the sectors where the files resided and neither does Windows. I wrote an article on how to do this from within Windows. Yes you can do it by hand via the “shrink disk” option in VMware Tools, but as Leo already pointed out there’s no way of scheduling that one, as far I have discovered.
So most of the stuff written about in Leo’s article applies to Windows, yeah also the partition alignment! DO IT! But the zero-out procedure won’t work, I’ve wrote one a while back and here it is:
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
Be sure to download Sdelete before you start, and remember that this script also does a defrag. If you are running “thin” disks than doing a defrag might not be the smartest thing to do, if so just delete the following line from the vb script:
Return = WshShell.Run("defrag " & d & " -f", 1, TRUE)'
Leo Raikhman says
Thanks for the shout-out Duncan.
I’ve also created a VMware Windows Templates guide that expands on your stellar effort, in fact it was your effort that got me thinking about how we can take it further:
http://lraikhman.blogsite.org/?p=281
Keir Asher says
Hello Duncan,
I know this is an old post, but bares revisiting. The link to the template is out of date. Also, changing the kernel ticks accordingly is also something to add the a Linux template one may create. Results, by themselves, are small but across many VM’s would be advantageous. I have a post regarding this here:
http://tar-zxv.blogspot.com/2009/07/vmware-guest-optimization-linux.html