How Microsoft Solved “Dll Hell” (and why it is backfiring)

If you are running a copy of any version of Windows since Windows Vista (i.e. Vista or Windows 7) you might be somewhat aware that the Windows folder on your system drive is quite large.  Indeed, it is most likely to be the largest consumer of disk space on that drive.

There are varying excuses for this ponderous reality.  In some cases it accounts for service packs, numerous patches released via Windows Update, a large driver cache, system debugging (stack traces, memory dump files, log files) and, of course, core system files and operating plumbing – including the windows registry.

You’ll also find multimedia files (such as system sounds, wallpaper (images) and so on), internationalization resources (if installed), fonts, a temp file directory, the .Net Framework’s Global Assembly Cache and a weird folder called the “winsxs” (Windows Side-By-Side) folder.

Hard Drive Space Matters!

Now, I have a solid state drive (SSD) on a Dell Studio XPS which I bought last year.  The disk’s I/O performance is amazing, and it is quite possibly the best hard drive I’ve ever owned but, as there always is, there’s a catch – it’s only a maximum of 60GB.  It was fairly pricey too, coming in at over $AUD 300.  To say that disk space is at a premium is an understatement.

Having limitations means I routinely am in need of a bit of “disk space recovery”.  Now, I also have an installation of the recently released Visual Studio 2010 RC 1 as well as other development tools (Internet Information Services, SQL Server 2008 Nov 2009 CTP et cetera) plus Microsoft Office 2007.  This greatly reduces my available disk space.

After running “Disk Cleanup” I recovered some much needed space, but it also removed a lot of installers which were sitting around doing precious little.  Now, I have trouble repairing, uninstalling or modifying installed programs on the system – including installing Office 2007’s service pack 2.  Great.

The Windows Directory

So I’ve started looking into why the Windows directory uses nearly 20 GB of my precious hard drive space.  The outlook (pardon the pun) is not positive.  My first review brought to my attention the winsxs folder and its reported ~6GB of hard drive space consumption. 

Further reading reveals that this is (apparently) inaccurate.  The use of “hard links” has Windows Explorer reporting an inflated disk use (as it follows links to include the file size of files actually located elsewhere).  So what ius a “hard link” – here’s one definition:

[1] In practice, nearly every file in the WinSxS directory is a “hard link” to the physical files elsewhere on the system—meaning that the files are not actually in this directory. For instance in the WinSxS there might be a file called advapi32.dll that takes up >700K however what’s being reported is a hard link to the actual file that lives in the Windows\System32, and it will be counted twice (or more) when simply looking at the individual directories from Windows Explorer.

But is this really true?

My investigation leads me to believe that the reported size is probably accurate, but take it with a grain of salt.

Whilst we may be excused for not trusting the Explorer shell (which is a shadow of it’s former trustworthy self due to browser helper objects and questionable kernel changes) we probably can trust the command shell.

Somewhere in my winsxs folder I had a 9 mb MPEG file.  A search via the command shell reported two instances (both under the Windows directory).  The question remains – can we trust the command shell also?

image image
The result of a command shell search                              Total disk use of the winsxs folder, reported by the command shell

I deleted the original file, supposedly leaving the “hard link”.  I could still view the file (in Media Player) located in the winsxs folder, leading me to believe that the file in the winsxs folder is a copy, not a hard link.  Which begs the question, how many copies (of files) do we have?

Looking at the bigger picture, I used the Explorer Shell to report on the relative size of the winsxs directory compared to the overall Windows directory.

image 
Comparing the size (reported by Windows Explorer) of the %sysdrive%\Windows\winsxs folder comparative to the contents of the Windows directory

Now, if the winsxs folder actually does not contain close to 7GB of files, isn’t it a big problem that Windows Explorer (and by extension, the Windows operating system) thinks that it does?  In effect, isn’t that robbing me of close to 8 GB of hard drive space, via misinterpretation?  When I run out of space (according to the shell) what happens?

One thing is for certain: the Windows directory consumes a lot of hard drive space.

In reality I think the winsxs folder really does contain most of that 7 GB and I’m not pleased.  Reading through threads I came across this little gem of a sentiment [2] from a Microsoft Support Engineer:

1. Duplicate files. Searching for and deleting duplicate files has always been something that Windows users have performed in an effort to reduce used hard drive space. However, this was done because hard drive space was very expensive and hard drives were very small.

If this was 8 or10 years ago, this would still be a viable option, but it no longer applies since hard drives have become so large and very inexpensive. When Windows XP was first released, a typical hard drive cost around 2.99 USD per GB. Today, you can find a 500GB SATA 7200RPM hard drive for much less than 100 USD. The typical cost of hard drives is less than .15 Cents per Gigabyte. This means that a WinSxS folder that is 6GB costs around .90 Cents, and uses slightly more than 1 Percent of the drive. That’s about the same cost as a large bag of potato chip
s.

This obviously doesn’t apply to Solid State drives, where space is at a premium.

Conclusions?

Now, personally, I think this “solution” is pretty short sighted.  Admittedly, this is probably not a big issue for people with 250GB+ of hard drive space, however for users where hard drive space is at a premium, this is a big problem.  The winsxs folder currently consumes at least 10% of my total disk space, and the Windows directory consumes over 30%.

The concept of keeping many copies of “system files” lying around the system shows a general irresponsibility towards conservative disk space consumption.  It would have been nice for this “solution” to have been optional.

In case you haven’t stumbled across the various forum threads on this topic (and there are a few – some linked below).

Bonus Information

If you are trying to recover some of your precious disk space, and you initially configured Windows 7 to use a hibernation file (like I did), you may be interested in reclaiming that space used by the hibernation file (typically 1 GB per 1 GB of memory).  In my case, I had 6GB of 59GB occupied by the hibernation file. 

I’ve found this article to be especially handy in walking you through the process of restoring to a state without hibernation:
http://www.sevenforums.com/tutorials/819-hibernate-enable-disable.html

Forum Threads:

[2] http://social.answers.microsoft.com/Forums/en-US/w7hardware/thread/450e0396-6ba6-4078-8ca0-b16bf4e22ccf

http://social.technet.microsoft.com/Forums/en-US/itprovistadesktopui/thread/b7fd2614-80e9-454c-b684-709567738424

http://social.technet.microsoft.com/Forums/en/w7itprogeneral/thread/f0862648-0a96-4aa4-8847-76c216d169f3 – awaiting a response from Microsoft

Further Reading (at your own risk):

[1] Windows 7 Disk Space

Don’t Trust All Your Eyes Tell You… (hard links in Windows Vista)

What is the WINSXS directory in Windows 2008 and Windows Vista and why is it so large

Engineering Windows 7 – Disk Space

Leave a comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.