WinSxS, Disk Space and Windows 7

November 20, 2008

in Microsoft, Vista

A very hot topic among Vista user is the seemingly robust size of the WinSxS directory and it’s ability to grow with apparently no limit.  While most users are not too overly concerned with disk space and have GBs to burn, the majority (myself included) still like to keep the footprint of the operating system as small as possible.  I have posted on the topic a couple times before:

I came across an interesting post today by Michael Beck on the Engineering Windows 7 blog about Disk Space.  As I began to read the post I realized that this was by far the best explanation of the WinSxS directory to date.  I encourage anyone and everyone who is interested in understanding the WinSxS directory in Vista to give this post a thorough read through.  You may just change your mind about moving or deleting the WinSxS directory.  A couple interesting tidbits to wet your appetite:

The Windows SxS directory represents the “installation and servicing state” of all system components. But in reality it doesn’t actually consume as much disk space as it appears…

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.

The WinSxS directory also enables offline servicing, and makes Windows Vista “safe for imaging”.

While it’s true that WinSxS does consume some disk space by simply existing, and there are a number of metadata files, folders, manifests, and catalogs in it, it’s significantly smaller than reported. The actual amount of storage consumed varies, but on a typical system it is about 400MB.

Click here to read the post…

68,722 views
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 4.00 out of 5)
Loading...
Mathew Snyder January 4, 2009 at 12:53 am

Ok, so what do we do about the fact that this directory “appears” to consume multiple GB of space causing our system to see the disk drive as being full when in reality it isn’t?

Matt January 5, 2009 at 9:59 am

That my friend, is the million dollar question that no one seems to be able to answer with much authority. I’m keeping my ears open for any new information on this subject and will pass it along as soon as it becomes available.

Chris Bering January 6, 2009 at 1:38 pm

Hi Matt,

Winsxs in Vista takes up much more than 400MB.
This is due to the 8,10,16 or more different backup versions of each of thousands of files kept in winsxs.
Just the backups of Vista’s sample media files (those one deletes from the public folder) takes up more than 200MB in winsxs.

For instance, read this thread:
http://social.technet.microsoft.com/Forums/en-US/itprovistaannouncements/thread/9411dbaa-69ac-43a1-8915-749670cec8c3/#page:9

It’s me that have written WinsxsLite.bat, and it’s GBs, not MBs, one can remove from winsxs.

Best regards,
Chris Bering

Anonymous April 20, 2009 at 10:48 am

We only need a utility to calculate the actual size of WinSxS which skips/doesn’t recalculate/take into account hard links. Anyone?

Simon April 24, 2009 at 5:43 am

As I understand it each file in the winsxs folder should be unique within that fold BUT will have a link count > 1 – the other link using this should be somewhere in program files, or the main windows hierarchy.

if you ask for a file size sum of either of these areas separately you will end up counting the sizes twice.

Possible problems for space I can see is there you have files in winsxs with a link count of 1 – this means other the original has been removed without cleaning up winsxs, or the original is on a different volume and its created a copy rather than a hard link. Or there was never an original and something is directly referencing winsxs which means there is no way you can know if a file is safe to clean up.

I’ve been looking at the APIs and it should not be too difficult to write a tool that recurses through the file system and keeps a track or which files are hardlinked to which (you can get a link count plus the file ID from the file info struct) – if I get round to writing it I’ll post it somewhere.

I’m still more than tempted to backup older versions elsewhere, and turn the older versions into hard links to the latest version unless there are major version number changes in the library – though this risks breaking software when dll APIs change.

Omer May 28, 2009 at 2:19 pm

I’ll read the whole blog again in detail. But I am sorry I can not buy this argument that these are not actually stored and only reported incorrectly. My WinSxS folder has grown over 10GBs and I believe it has nearly similar footprint on disk because I am running low on space and analyzed all other contents of this partition.

Given the argument in this article IF somehow it miscalculates disk space used by WinSxS then this should be true
summing up the size of all folders n files in my C:\ + free disk space should be greater than the total disk size. This matches exactly as my partition size hence making it hard for me to digest what’s written by the Microsoft blogger.

zaw May 29, 2009 at 4:16 pm

Mine is at 23Gigs!! over 1 year of install and have a tons for programs installed and removed from time to time.

I think that directory is just result of LAZY Coders working at Microsoft!!

Matt May 29, 2009 at 4:19 pm

Good grief.

JD June 2, 2009 at 10:13 pm

ya i just installed windows vista x64 ultimate YESTERDAY onto a 20gb partition on my laptop, other partition is 93gb or so, anyways, i ran windows update yesterday, of course there was about 93 of em, so whatever i installed them, and now my winsxs folder is at 14gb and ive got around 200mb freespace, vista blows lol, imma try windows 7 again, i have on here in the past and didnt have this problem, mainly since i didnt install 93 updates on 7 but oh well, i think 7 ran better then this vista ultimate ive got now

sonoyuu December 26, 2009 at 2:38 pm

I have been working with Vista since early beta, and (unfortunately) most of the systems in my company network are Vista Ultimate, though the networks of my clients are mostly XP Pro/SBS 2003. After paying for Vista Ultimate licenses it was quite aggravating to learn of this irritating and limiting problem associated with the Winsxs folder.

Let me be blunt, when I learned Windows 7 also has this system limitation I was finally convinced I need to migrate away from Microsoft and start implementing more Linux systems in my infrastructure.

This folder which can range from a few gigs to 16+ GB may seem innocuous enough to those with 5400 RPM or 7200 RPM HDD that are 100+ GB, but when you have 37GB 10,000 RPM HDD in most of your systems it can create serious problems when you don’t expect such a large foot print for the OS. What makes matters worse is that when you uninstall applications, the DLL “copies” are kept in the winsxs folder, they are NOT removed.

Even if you are creative; managing to create junctions/symbolic links and move the winsxs folder to another drive (not a task for the faint of heart) you will find that you can no longer install windows updates as you will generate error 80070011 because Microsoft will not install updates into a folder junction.

Unfortunately, I see Windows 7 as being a slightly less buggy Vista with some changed/added features, yet is still full of flaws. On the other hand, the Linux methodology is becoming more polished and user friendly despite its limited market share. The reality is that the majority of my client networks will remain XP Pro as long as XP Pro remains available.

Microsoft’s current line up is more geared towards the high school/college aged social networker than it is towards business and productivity. From my view, Vista and Windows 7 are moving too far away from what computers do in the workplace and too much towards what people do in their personal lives. Employers realize this which is why I think Linux will replace many XP systems when XP is no longer available for licensing.

pbb January 25, 2010 at 7:49 pm

I have found one very useful application to display linked files: Link Shell Extension (http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html). It will show information about hardlinks, symbolic links and junctions.

A quick scan of my relatively clean Windows 7 Ultimate 64-bit install, shows around 600MB of “orphaned” files (that is, files that don’t also exist in other folders) in the WinSxS folder, out of 5,5GB reported. This means around 5GB of the files in WinSxS is actually hardlinks to files in other locations in the Windows folder.

This makes more or less sense, since my total Windows directory tree reports 11GB. That is close to 5GB “real” Windows files, plus 5GB hardlinks in WinSxS, plus 0.6GB orphaned files in WinSxS.

If you turn this calculation around, you can make an educated guess about how much waste your WinSxS folder really is:
1. Check the reported size of your Windows folder with all subfolders.
2. Substract the reported size of the WinSxS folder with all subfolders.
3. The remainder is all orphaned files in WinSxS plus all files in the Windows folder that don’t have a hardlink in WinSxS.

pbb January 25, 2010 at 8:05 pm

Sorry, that calculation was total nonsense… Time for me to go to bed 😉

But using the Link Shell Extension, you can see how many of the files are not hardlinks…

FBKK June 8, 2010 at 4:50 pm

Actually some of the files in the WinSxs Files are actually hardlinks to files in other locations, which means that if you add up the size of the WinSxS folder to other folders on C: and free space you will exceed your partition size, by my calculations on my C: drive I have some 2,5 GB of extra space on C, which means that at least 2,5 GB of reported disk space is made up of hardlinks to other files. That being said, my winsxs folder is about 7 GB in size, which means that at it contains about 4,5 GB of files which are not hardlinks, and this is not surprising if you know how the winsxs folder works, basically it stores every version of every shared dll on a system, and supposedly it deletes a version when the system is sure that there are no more applications using a particular version, however it is very difficult to determine when a shared dll is no longer in use, so more often than not, just to be sure, windows keep every version of every patch, update and fix dll in the winsxs folder, and on x64 system usually 2 version of every dll, the x86 and the x64 version, side by side as the folder name suggests. What you end up with is a bloated beast.
Recently I find myself using Ubuntu more and more, and it's surprisingly nice, and I find myself able to do everything I would do in windows, except hardcore gaming and windows programming of course, and while OpenOffice is definitely not on par with MSOffice I think it would be usable in most office settings. So we still have 4 more years of WinXP support, and to me it remains to be seen if Linux will even be considered as an alternative, but it definitely should be.

idea November 14, 2010 at 8:07 am

How about a tool that converts hard links to symbolic links , so that explorer shows correct file size…

Jonny October 2, 2015 at 8:17 am

is this possible? how?!

pingram3541 April 16, 2011 at 11:43 am

How about Microsoft recognizing the legitamate reason for junctioning the winsxs folder now that small 32 and 64gb ssd drives are growing in popularity and cost is dramtically dropping every day and create an update or SP that allows updates to process regardless of what partition files or hard links reside on.

XDude April 17, 2011 at 1:34 am

HEAR HEAR, pingram!

eli May 20, 2011 at 3:38 am

GUYS! A REVELATION!

Basicly, WIN7 has an option to sort and view files by “Date Accessed”. If you do so in winsxs directory you will be amazed at how many of the files was not accessed for, say 2 years, in my occation, that leads me to believe that these files are obsolete to my system and thus can be deleted.

However, I want to emphasize that I do not delete the files, rather that used winrar to delete the files as it archives it soewhere else, and so should any problem arise I have my backup stored.

So far so good, I’ll keep you posted

Jasina September 26, 2011 at 2:27 am

well that seems to be a good option for me. better than nothing. i am gonna get nearly 15 GB.

Jonny October 1, 2015 at 5:18 am

So, any hiccups?

Just stumbling upon this, yet to try (reluctant after reading of FAIL on w7 x64 after reboot)

Would like to try on offline systenm, not sure of syntax…

The magic is ln.exe – http://goo.gl/gveWB

Jonny Hotchkiss February 11, 2016 at 1:04 pm

Just spotted last comment, great tip eli

Was there ever any problems that required a restore-backup-from-archive?

about to try this 🙂