How can I find out how much disk space the WinSxS folder is really occupying?


If you ask Explorer or some other disk space utility for the size of the WinSxS folder, you'll get an inflated value because WinSxS consists mostly of hard links into other parts of Windows, so it doesn't really occupy space on its own, but naïve disk space calculation algorithms don't take hard links into account (in part because it's not clear how one should account for them).

The command to analyze the contents of the WinSxS directory is

dism /Online /Cleanup-Image /AnalyzeComponentStore

This Web page explains how to interpret the results.

Comments (17)
  1. Lennart says:

    Does Windows display a non-naïve value in the properties of a drive (e.g. in the properties of your C:\ in the Explorer)?

    1. It should, since that value comes from the file system directly. I'm pretty sure it comes from the file allocation bitmap, but it could also be the MFT. I don't remember which exactly. Pretty much every filesystem has a way of calculating the total volume allocation size or free volume size without examining every single file though.

      1. middings says:

        "Rule of thumb: the pie does not lie," write Jeff Hughes (PubSec) and Robert Mitchell, Senior Support Escalation Engineer, in the Ask The Core Team blog. For a "a non-naïve value" of disk space usage, they recommend just what Lennart supposed. They write that the volume's properties page gets its values from "a special metafile called $BITMAP", which is one of the sources MNGoldenEagle remembered.

        1. DWalker says:

          Wait... I think that's a "naïve" value, not a "non-naïve" value. I think. I could be confused.....

  2. Ray Koopa says:

    Oh yeah, I remember one of these great "tuning tools" which shipped with a disk space analyzer. The whole diagram of the Windows partition was mostly useless since it claimed WinSxS would be 50% of it, and the best thing was it even suggested to "check and clean up WinSxS".

  3. this command doesn't work for win7 and your explanation link looks 404?
    Another way to check is sysinternals DU tool, but the end result is that winsxs is just big, and hard linking accomplishes very little
    http://www.zabkat.com/blog/how-big-is-winsxs.htm

    1. The blog post is slightly disingenuous in stating that the hard links may be worse than the alternative. The alternative would be actual files, which will always occupy more space. The conclusion that the hard links themselves could occupy more space than the file they're linking to is correct, but the alternative is still worse.

      It is kind of unfortunate that the payoff is so small. On my system the difference amounts to about 409MB, which by itself is pretty large but compared to 15.8GB is only about 2.5% of the total size of WinSxS (reported by Explorer, at least).

  4. Juan says:

    @Raymond. What is the minimum version of the OS for this? I got Error 87 "The analyzecomponentstore option is not recognized in this context."

    1. Nick says:

      Following the link, the TechNet page notes "The /AnalyzeComponentStore option isn’t recognized on Windows 8 and earlier."

  5. Waleri says:

    There are plenty of stuff in WinSxS that are not hardlinked by anything and does occupy space.
    I guess they are needed for rollbacks or someting.

    1. Darran Rowe says:

      Well, if an update is installed then it really needs to keep all of the update files around*.
      If an update isn't completely superseded, that means that at least one of the files is actually linked into the Windows directory, then it must keep the rest of the update around regardless*. If an update has been completely superseded, then the update can be removed*.
      This is like this because prior to Vista, it was possible to install an update, and later uninstall it and have it restore out of date files under the Windows directory. The new CBS way of doing updates has it checking the WinSxS directory for the most recent version of the file and then links that to where it needs to go. So yes, those files are there for the case of uninstalling updates.
      One other thing to point out, along with the ability to analyse the WinSxS directory, Windows now has the ability to uninstall updates that are found to be unused after the analysis. While I can't remember if 8.1 did it automatically, I know 10 does. You can also run it manually using DISM.exe /Image:C:\test\offline /Cleanup-Image /StartComponentCleanup
      *There is a major caveat here if the /ResetBase option was used at any point. It makes an update permanent in exchange for removing unused files from that update and the Windows base package.

  6. Thomas A says:

    Isn't the original file also a hard link, meaning that it is hard to define which file is using up the space and which one is "just a link" (well, in this case there's more context about the directory, but in the general case)? At least that's the impression I have for hard links on Linux.

    1. skSdnW says:

      There is no original and link difference, they are all just file names in a directory and they all point to the same data stream. The only complication is for small files where the data might be stored directly inside the NTFS file entry structure and I'm not sure exactly what happens in this case, perhaps the file is forced to be non-resident when a hard link is created?

      1. Josh B says:

        The MFT will store multiple file name records in the file record. They aren't that large, 94 bytes + size of file name, so if the file is 10 bytes just hard linking it a few times isn't going to evict it. Eventually it will, but it's not like a single extra hard link breaks MFT storage optimization.

  7. Joshua says:

    Or the easy way:

    /cygdrive/c/windows/WinSxS$ find . -type f -links 1 -print0 | du -sk --files0-from=-

    This counts all the kbyes only found in WinSxS.

  8. Michael says:

    Did anyone else notice that on the linked page, in the Example output, they show:

    ***
    Backups and Disabled Features : 506.90 MB
    Cache and Temporary Data : 279.52 KB
    ***
    Then after that example they sum those numbers as if they were both MB to 786.42 MB.

  9. Matt says:

    My issue with this has always been, does it matter? If Explorer thinks the disk is full, I can't save any more files, regardless of how much space WinSxs is really using.

Comments are closed.

Skip to main content