Slimming down a Win 7 install

Joined
Aug 21, 2009
Messages
588
I have come across some Win 7 installs that are 30GB (total data in the Windows folder), I think I have actually seen larger but can't remember for sure, and I know that much of this is due to updates and who knows what else. I have a relatively fresh install (probably has less than 100 hours and 20 boots on it) that is at 22GB - Original install was Win 7 w/ SP1 so it didn't have to do through an SP1 update. This seems excessive IMO.

Here are some examples of Win 7 installs at various states of use.

Virtual machines with Win 7 Pro SP1installed - 1 week old install
-Fresh install - not connected to internet yet (no software installed)
10.5GB - 62,508 Files in Windows folder
-Same as above but with updates installed
18.0 GB - 90,229 Files in Windows folder

Win 7 Pro SP1 w/ ~ 100 hours & ~20 boots - currently updated (installed 5 months ago)
22.1GB - 102,688 Files in Windows folder

*The above installs don't have any "extra" software or files installed like 20,000 fonts or anything.

I need to figure out how to minimize the size of this folder by either reducing the current size or limiting the size it can reach as I'm going to install this on a drive with fairly limited capacity. If it isn't possible to remove certain files, is it possible to redirect some folders to another drive? I know in Linux I can spread an OS install across multiple HD's or partitions and even split folders across multiple HD's/partitions.
 
I'd use a combination of Windirstat (run as system using psexec to identify the SYSTEM owned folders, too) to identify the big folders, and for any you want to move (basically, non-required-to-boot stuff), you can move the folder to a secondary drive and use mklink /s to create a symbolic link to it.
 
1. Put the swap file on a different drive - it normally defaults to a max size of the amount of RAM installed.

2. Disable Hibernation - This will free up space equal to the amount of RAM.

3. Clear out C:\Windows\Prefetch - it will not put anything back in there after you clear it out.

4. Regularly clean out C:\Windows\Temp

5. Run drive cleanup and have it clean out everything. An update quite a while ago added the option to clean up old Windows updates - This should free a couple GB at least.

6. Clean out the windows update cache on a regular basis.
 
5. Run drive cleanup and have it clean out everything. An update quite a while ago added the option to clean up old Windows updates - This should free a couple GB at least.

This is probably where most of your data is being consumed. You'll need to have KB2852386 to expose the Windows Updates button on the drive cleanup wizard.
 
Dont forget that the WinSxS folder uses hardlinks -- which essentially means some files have 2 file names (or more) but the actual data only exists on the disk one time, so by going to right click properties to see the size of the windows folder you are counting the files twice (or more) when they should only be counted once. You can see this for yourself if you delete a file that is a hardlink (ie has more than one name) your free space will not change until you delete the last reference to the file.

There are a few things you can do though. If this box was win7 plain THEN upgraded to SP1 you can remove the SP1 uninstall info by running this:
Code:
dism /online /cleanup-image /spsuperseded

Also, when a windows update supersedes another update (ie it replaces the same files) the old ones will be left remaining in the WinSxS folder. This is so that you can uninstall the updates in any order. If you want to remove all of the superseded updates you can use a tool called Deep Clean (Made by Microsoft). You can download it here This tool basically does the same thing as KB2852386, which is what the poster above me mentioned, BUT you have a lot more manual control when you do it this way.

You can see the options by running:
Code:
deepclean /help

BUT, I would suggest running it with the following CMD line:
Code:
deepclean /orphan /compress:full

It will want to reboot after it's done, and it instructs you to run it again after the reboot.
So use the same cmd line again:
Code:
deepclean /orphan /compress:full

And it will run through and show you what updates it is removing, and also how much space it is saving you! I run this every month or two on all my systems. I use it on servers at work quite often as most of them are VM's and their C: drives get full from windows updates over time, so you have to run this every so often to get your space back. Obviously, you wont be able to roll back to the updates it is removing, but you probably don't want to do that anyways.
 
Last edited:
Thanks for the replies!

The original install was with SP1 so the update wasn't an issue.
Disk cleanup freed up - 66MB
PreFetch has - 2.1MB
Temp had - 49.5MB
Update folder had - 600MB
No hibernation file
Pagefile.sys is located in root folder of c:


I'm now at 24.5GB of content in the Windows folder.

I didn't get a chance to do the suggestions of Extide but am working through it.

Here is my WinDirStat results

windows.jpg
 
Did you run disk cleanup as admin (you can launch it and click the "clean system files" icon and make sure that "service pack backup files" is checked)? Extide's suggestion for superseded files should do the same thing, and is a good suggestion.
 
lol bloat

Code:
>deepclean /d

Determining starting sizes (discounting shared files)...
   7.10 GB --------------------------------- -- C:\Windows\Winsxs
  77.06 MB --------------------------------- -- C:\Windows\Servicing
   4.34 GB --------------------------------- -- C:\Windows\system32\driverstore
   9.35 GB --------------------------------- -- C:\Windows\Installer

  35.06 GB (  35.26 GB ignoring compression) -- C:\Windows

and after:
Code:
Compressing inactive files...

Determining ending sizes (discounting shared files)...
   4.73 GB (   7.21 GB ignoring compression) -- C:\Windows\Winsxs
  77.06 MB --------------------------------- -- C:\Windows\Servicing
   2.89 GB (   4.34 GB ignoring compression) -- C:\Windows\system32\driverstore
   8.51 GB (   9.35 GB ignoring compression) -- C:\Windows\Installer

  31.05 GB (  35.99 GB ignoring compression) -- C:\Windows
---------
   4.64 GB reduction in size this time
---------

Still bloated. I could recover ~400MB (size on disk) space by wiping out the Winsxs\Backup files.
 
Last edited:
Considering I can get 32 gigs on an SDHC that is the size of my fingernail for $13, and a 60+GB SSD from a decent brand for 40-50, doesn't complaining about 5 gigs seem a bit silly? I mean, geez, I've redownloaded bigger files because I couldn't remember which folder they got saved in when I was swapping between computers.
 
It's not 5GB which is the problem, but the pointless bloat Windows generates. Literally every other major OS maker does not have this poor design MS adopted.
 
Considering I can get 32 gigs on an SDHC that is the size of my fingernail for $13, and a 60+GB SSD from a decent brand for 40-50, doesn't complaining about 5 gigs seem a bit silly? I mean, geez, I've redownloaded bigger files because I couldn't remember which folder they got saved in when I was swapping between computers.

if we are talking about one file, then yes, but when we are talking about 100's to 1000's of OS's being imaged and saved on SAN's, size starts to be an issue.

If I can reduce my OS folder size by 20-40%, it means a lot less time in transfer times & storage over the course of setting up A LOT of systems.
 
Could anyone share the Microsoft "Deepclean.exe" tool please. I could not find it anywhere.
 
What about using a utility like NTLite to create a custom install disk that strips out unnecessary components?
 
What about using a utility like NTLite to create a custom install disk that strips out unnecessary components?
Deepclean could be used after instalation (I don't know if can be used with Windows offline images), used on demand or scheduled for cleaning/compressing WinSxS (and Drivers too, Win7 even with KB2852386 doesn't do that) afte Windows and driver updates, and also gives statistics. It think it is a "gem" from Microsoft, but I couln't find any download links or other references to it on the Web, and I tried hard. If anyone could help we shouldn't lost this valuable tool for Win7 or Win2K8R2.
 
A lot of space can be saved by disabling shadow copies and using drive cleanup as administrator and cleaning all temporary files including the ones from windows updates. They easily build up to gigabytes in size. Hibernation should also be disabled on a VM where you can just pause it anyway when you don't need it. My Windows VM sits sometimes weeks in paused state and is instantly available if I need it. You can also manually set your swap file size, it doesn't need to be your ram size. In most cases something like 1Gb is quite enough.
 
A lot of space can be saved by disabling shadow copies and using drive cleanup as administrator and cleaning all temporary files including the ones from windows updates. They easily build up to gigabytes in size. Hibernation should also be disabled on a VM where you can just pause it anyway when you don't need it. My Windows VM sits sometimes weeks in paused state and is instantly available if I need it. You can also manually set your swap file size, it doesn't need to be your ram size. In most cases something like 1Gb is quite enough.
Thanks I already do your tips. I have a fixed pagefile, use cleanup as admin, but I leave Shadow copies enabled because sometimes I use System Restore.

The Deepclean tool can do more things (cleanup/compress drivers, installer folder, ...) , is a command line tool, from MS and if it works also on offline images I don't know other tool that can do the same on Win7/Win2K8R2 (for me Win7 still is my 1st OS choice). It's strange that almost noone on several foruns know this tool with additional methods for reducing Windows "bloat".
Maybe extide or pxc can see this and help me.
 
Thanks I already do your tips. I have a fixed pagefile, use cleanup as admin, but I leave Shadow copies enabled because sometimes I use System Restore.

The Deepclean tool can do more things (cleanup/compress drivers, installer folder, ...) , is a command line tool, from MS and if it works also on offline images I don't know other tool that can do the same on Win7/Win2K8R2 (for me Win7 still is my 1st OS choice). It's strange that almost noone on several foruns know this tool with additional methods for reducing Windows "bloat".
Maybe extide or pxc can see this and help me.

If it's a tool from Microsoft why can't it be found on their site?
 
The problem is that no matter how you try to clean your windows the updates are going to fill your drive forcing you to clean and clean and clean - until you get an infection and then you need to clean, clean, clean AND clean lol.
 
Back
Top