Quick post here. I have been working with some customers lately to work on reclaiming guest space inside of their Windows 7 desktops in a VDI environment and for the most part worked through the standard procedures. Removing files in temp folders, ensuring the recycling bin was empty and then running sDelete to reclaim the space.There was still a build up of space though. Now mind you this is a persistent desktop, so how much this matters and the like changes if the desktops are linked clones or use SE Sparse.
We identified a lot of space was used by the many Windows updates that are constantly streamed in the the machines. So we started taking a look at seeing if we could free up some space there. In Windows 8 a new feature was introduced to easily be able to remove archived updates that have gone through the system and the files they replaced. These files can easily lead to 100s of MB or even GB of data per virtual machine. Windows 8 automatically has a scheduled task that clears any of these out that are older than 30 days, which is great housekeeping.
Windows 7 does not have this task, but it does (in Update 1) have the ability to simply remove these files.
In the disk cleanup wizard, you can check the “Windows Update Cleanup” to have those files removed. In the screenshot above it is about 622 MB of space.
So let’s walk through the process. I deployed 16 Windows 7 Update 1 virtual machines onto the same datastore on the FlashArray. After initial deployment (prior to running Windows Update) the 16 VMs consumed about 4 GB of physical space on the SSDs, which was about a 13:1 data reduction, so on the low to medium end of what we see for data reduction in VDI environments.
I then ran Windows Update (it was a lot of updates) on all of them and the space usage went up to 26 GB. Quite a bit more space.
I then ran the the disk cleanup to remove old files. This next part is important (and somewhat annoying). You need to reboot the desktop before space can be reclaimed. Apparently Windows needs to do this to officially release this space. Upon the next power on you will see this screen:
Then ran sdelete on the C: drive (sdelete -z c:).
As you can see not all of the space was reclaimed, this is because not nearly all of the space consumed by the updates could be. It averaged reclaiming about 250 MB of physical SSD space per virtual machine. Scale this up to 1,000s of VMs in a VDI environment this could turn into a decent amount of space.
Some thoughts…
1) This space bloat from updates makes a good argument not to use persistent desktops if space is an issue. Might be better off recomposing from a patched gold image. When patches are individually applied Microsoft seems to do something that makes them not globally dedupe well–still looking into this though.
2) The reboot makes this a bit of an unattractive option like anything that requires downtime.
3) The amount of space reclaimed isn’t extraordinary by any stretch of the imagination. But this combined with other cleanup operations will give you a decent amount of breathing room.
4) The worst part, which basically makes this untenable at scale is that in Windows 7 this cannot be scripted. Well the part to cleanup the updates. In Windows 8 it seems to have this function in DISM.exe, but while the patch was backported for the Windows 7 GUI to do this, it does not seem the CLI option was. So as far as I can tell from PowerShell or standard CLI there is no simple way to do this.
If this isn’t scriptable, at scale this exercise is essentially pointless. While you can get back space, doing so isn’t practical if you need to do it with potentially 1,000s of VMs. I’m still looking into if there is a way to do this with group policy and the like. I originally wasn’t even going to write this post until I found a solution at scale, but I figured I would put it out anyways to see if someone knows something I do not. Stay tuned.
i have VDI computers with only 60 GB HDDs. i found a utility called PatchCleanter that you can download here http://www.homedev.com.au/Free
I’ve been using it for several years and have not had any problems with it. using this utility in combination with the standard procedures, like deleting temp files, etc, has allowed me to maintain these drives with enough free space so windows updates can be done regularly. the only catch is that you need 3 gigs to install it. on VDI’s that had very limited space i temporally shrunk the pagefile, did the install then resized the pagfile.
type…. PatchCleaner… sorry about that