« SIGGRAPH Day 2: Softimage Party | Home | Some TFU Love »

Individual Entry With Comments

November 28, 2008

WinSxS Disk Space Usage: It’s Not What You Think

Filed under Computers, Programming, Software

One common complaint about the winsxs folder is that it takes up too much space.

My winsxs takes up almost 9 GB!image

Or does it?

According to this post by Microsoft, WinSxS has many duplicated files. The files are are *not* copies, but are instead “hard links” that point to the same data, and thus do not take up any extra space. Microsoft says a typical WinSxS folder contains around 400 MB of data.

The problem is that DIR and Explorer are not aware of the difference between an actual file and a hard link to a file. The disk usage reported by these two programs is as if each hard link *is* an actual file.

I did my own test to verify Microsoft’s claim. I created a small file called “original.txt” that uses 10 bytes. Then I created 10 hard links to the original file via the command line:

mklink /h hardlink<NUM>.txt original.txt

As expected, both DIR and explorer report that I’m using 110 bytes instead of just the 10 bytes of the original file:



image Symbolic links, on the other hand, work as expected and are recognized by both DIR and explorer.

I created symbolic links using this command line:

mklink symboliclink<NUM>.txt original.txt

Here are the results of DIR:

image Notice that only the original file reports any disk usage. The total directory size is only the original file, even though 11 files are detected. Also note that all the symbolic links are listed as “<SYMLINK>” and have a reference to the source of the symbolic link in []’s.

Here is what explorer looks like with symbolic links:


Explorer does the right thing and lists that the directory only contains 10 bytes. The symbolic links have “shortcut” indictors on top of the source icon. The file size for symbolic links are listed as 0 KB.

Comments (6)


If I add up all the space used by each directory plus the page file, it adds up to the used disk space of the drive reported by explorer. So if this is true, the free disk space is also wrong? the referenced post makes no sense, or Microsoft is lying.

This sounds legit to me...hard links work below the file system so DIR and explorer would have to do something special to know the difference (and currently they don't).

I think you have more free space available than what explorer is reporting. You could always try to fill up your hard drive to see for yourself...but I wouldn't recommend it.


Sounds ok but the fact is the space is reported as used in Explorer and tehrefore cant be utilized. Tried evrything and am stuck not being able to install SP1 due to the free size reported and darn winsxs is not nearing 8GB

I did some tests...

Explorer (via a folders properties) and "dir" report hard links as space used.

Linux does the same thing with its "ls" command.

On Windows, if you want to know *actual* space used, use the disk's property page or "my computer"...these numbers do not include hard links in the free space/used space calculations.

On Linux, if you want to know the *actual* space used, use the "du" command.


so the question is: who will be the first genius to come out with a tool that makes all those hardlinks in winsxs into symlinks?!


symbolic links and hard links are different, and serve different purposes; they are not necessarily interchangeable.

a symlink is only a pointer to the original file. as such, if you delete the original file (remove its only hardlink from the filesystem), the symbolic now points nowhere and anything that referenced that file via the symlink will no longer work!

a hardlink, on the other hand, is a unique and seperate entry in the filesystem that represents specific data on disk. you can delete a hardlink to a file without deleting the file itself; you have to delete all a file's hardlinks to really get rid of it.

this means that if a specific file is known by more than one name via hardlinks (as in the case of the winsxs folder contents) then deleting one of those links only impacts references to that name, and not everything that may rely on that file. if the entries in winsxs were symlinks instead, deleting the original file would make ALL the links invalid.

as mentioned previously, these concepts are common to linux/unix as well as [now] windows and there are some issues about how space is reported, however, most linux/unix commands and anything that deals with the filesystem [that supports links] understands and even expects this. ls, as mentioned, will indeed report an acutal size for each hardlinked file...it ALSO reports the total number of hardlinks that a file has. so you can tell easily if one file is referenced by more than one name. ls also doesn't [traditionally] report anything about the volume it only lists files and thier attributes leaving reporting volume information, like free space, to utilities that are designed for that such as df for entire volumes or du for files/directories and the like.

i think that its great windows supports real links...they serve a valuable and very useful purpose. however, i very much agree that the built in utilites (such as windows explorer, etc) need more intelligence in dealing with them.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


This page contains a single entry from the blog posted on November 28, 2008 5:35 PM.

The previous post in this blog was SIGGRAPH Day 2: Softimage Party.

The next post in this blog is Some TFU Love.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.34