The Windows Directory Consumes a Lot of Disk Space

I got a call from a colleague who was asking why the Windows directory on a Windows Server 2008 R2 machine was taking up almost 40GB of disk space.  I checked one of my servers and noticed almost the same – about 30GB on mine.  He noticed more readily than I did because his Windows install was on a partitioned drive where the C volume was only 60GB.  I, however, do not practice partitioning drives.  If I want more volumes, I get more drives. 

After some research, we noticed that the WinSXS fold was the culprit.  He was about to delete the folder when I asked him to stop.  I found it hard to believe this folder was so large just for the fun of it so I did some research.  I found many blogs and so forth that “tried” to explain the WinSXS folder, but most failed horribly.  As always, if you want the low down you have to go to the source.  I found this post on the Microsoft Ask The Core Team blog that did a fantastic job of explaining the WinSXS folder.  I highly recommend giving this post a full read.  You should also subscribe to the Ask The Core Team blog.

http://blogs.technet.com/b/askcore/archive/2008/09/17/what-is-the-winsxs-directory-in-windows-2008-and-windows-vista-and-why-is-it-so-large.aspx

There are some things you can do to combat this problem.  I recommend the following:

  • Do not partition out a single drive into multiple partitions.  If you want your OS on one volume and your data on another volume, then get multiple drives and place one set of drives in one volume for the OS and the rest of the drives in a volume for data.  For example, you could do a RAID 1 for the OS and a RAID 5 for data.  This way, you’ll always have plenty of room for the OS.  Partitioning one drive into multiple volumes, in my opinion, makes little sense any more.
  • Install only those applications you need on the computer.  The more applications you install, the more your C drive will fill up.  The same is true for Windows features.  Install only those you need.
  • Run the disk cleanup wizard.
  • You can free up some space by removing the roll back files for the last service pack you installed.

That last point bears some discussion.  When you install a service pack for Windows, you can always uninstall it.  This is made possible by the fact that Windows stores copies of the original files replaced by the service pack in the WinSXS folder.  If you have been running the service pack for a while and are very confident you will never need to uninstall it, you can remove the backup files which will make the service pack permanent (you can’t remove it).  On one of my systems, this freed up 10GB of disk space.

For Windows Server 2008 and Windows Vista after installing Service Pack 1:
Open a command prompt and run the command VSP1CLN.EXE.  This file is found in the %windir%\system32\ directory.

For Windows Server 2008 and Windows Vista after installing Service Pack 2:
Open a command prompt and run the command COMPCLN.EXE. This file is found in the %windir%\system32\ directory.

For Windows Server 2008 R2 and Windows 7 after installing Service Pack 1:
Open a command prompt and run the command DSIM.exe /online /Cleanup-Image /spsuperseded

Again, be reminded that should you run any of the commands above, the service pack will become permanent.  You will not be able to uninstall it.  However, you will free up some pretty significant disk space.  Be certain to test on a test machine before running this on a production computer.

JamesNT

Recovering from a Lost SUSDB

Imagine the following scenario:

  • You installed the Windows Internal Database role on Server 2008 64-bit.
  • You installed the WSUS role on the same server and set it to use the Windows Internal Database.
  • One day, you notice WSUS is not giving out updates and you cannot start the WSUS management console.  It tells you that SQL may not be started on the machine.

If your SUSDB has become corrupt, you cannot access WSUS.  Furthermore, you cannot uninstall WSUS.  And, as if matters can’t get even worse, you cannot uninstall the Windows Internal Database since WSUS is dependent on it.  Fortunately, you can resolve this issue by re-creating the SUSDB.  First, log on to your Windows Internal database using SQL Server Management Studio Express 2005 or higher.  If the SUSDB is listed, then delete it.  You will then need to go to the following location to remove the files:

%windir%\windows\sysmsi\ssee\mssql.2005\mssql\data

Delete the SUSDB database and log file.

Next, open up the following SQL file in SQL Server Management Studio Express and execute it to recreate the database:

%windir%\program files\update services\database\createdatabase.sql

This file will create and empty SUSDB database.  Once this is done, you can now remove WSUS from your server and re-install it if you need it back.  I recommend reinstallation as that will put your settings back in place like you had them.  Remember, the SUSDB you just created is empty with no tables in it.

I hope this information helps.  If anyone has a better solution, please add it to the comments section.

JamesNT