The Big Picture: A Warehouse With Many Versions on the Shelves

You met the folder C:\Windows\WinSxS before: in Chapter 21 — Windows System Files and Directories as a system folder, and in Chapter 22 — DLL Architecture as the home of "side-by-side" versions of files ("SxS" means side by side). Now we see why it exists: it is the warehouse that makes updates safe.

The core idea: Windows keeps every version of each component it might still need. Updates add a new version to the warehouse. They do not overwrite the old one. That is what makes rollback possible.

5.1 How Updates Add New Component Versions

What it is: The component store (the folder C:\Windows\WinSxS) holds each component in its own folder, named with its version. Live Windows files in places like C:\Windows\System32 are hard links into the store.

Quick reminder: hard links (Chapter 19). A hard link is a second name for the same file data on disk. Two names, one set of bytes. Deleting one name does not delete the data while another name remains.

   C:\Windows\WinSxS                         C:\Windows\System32
   (the warehouse)                           (what Windows really uses)

   ...\amd64_example-component_1.0\          example.dll  ─────────┐
        example.dll   (version 1.0) ◄──────────────────────────────┘
                                             (a hard link: same data)

   ...\amd64_example-component_2.0\
        example.dll   (version 2.0)          (not used yet)

Figure 35.5 — The store keeps version 1.0 and version 2.0 side by side. The live file in System32 is a hard link to one of them. Names here are made up for illustration.

What happens during an update:

BEFORE                         DURING STAGING               AFTER SWITCH
System32\example.dll           System32\example.dll         System32\example.dll
      │                              │                            │
      ▼                              ▼                            ▼
 [store: v1.0]                  [store: v1.0]                [store: v1.0]  (kept for rollback)
                                [store: v2.0] (new, added)   [store: v2.0]  <── link now points here
  1. The update adds version 2.0 into the store (staging, Section 3.3).
  2. At the switch (online or at reboot), the live name moves to the new version. No big copy is needed. It just re-points the link.
  3. Version 1.0 stays in the store for a while. If something breaks, CBS can re-point the link back to 1.0.

Why this design is clever:

BenefitHow
Safe rollbackThe old version is still there
Small switchRe-pointing links is faster than copying files
Many versions can coexistDifferent programs can depend on different versions (the "side by side" idea from Chapter 22)
RepairIf a live file is damaged, Windows can restore it from the store (sfc, DISM)

The folder looks huge in File Explorer, but the real size is smaller. If you right-click C:\Windows\WinSxS → Properties, it may show many gigabytes. But the same file data is often counted twice: once under WinSxS, and once under System32 (the hard link). Explorer adds up both names and over-counts. The real disk use is smaller.

The supported way to see the real figures is a read-only command (needs an administrator window):

DISM /Online /Cleanup-Image /AnalyzeComponentStore

Look for these lines in the output:

LineMeaning
Windows Explorer Reported Size of Component StoreWhat Explorer shows (includes the double counting)
Actual Size of Component StoreThe true disk use
Shared with WindowsData that is also used by live files (the hard-linked part)
Backups and Disabled FeaturesOld versions kept for rollback and features turned off
Cache and Temporary DataTemporary data
Date of Last CleanupWhen Windows last tidied the store
Component Store Cleanup Recommended"Yes" or "No"

Running AnalyzeComponentStore only reads. It changes nothing.

Check health too. DISM /Online /Cleanup-Image /CheckHealth (admin, read-only, fast) tells you whether a problem has already been flagged in the component store.

5.2 Component Store Cleanup

What it is: Over time old versions pile up, because they are kept for rollback. Windows cleans them on its own, using a scheduled task (a built-in job; see Chapter 12) that removes old versions after they are no longer needed, typically after a waiting period.

What you must not do:

Do NOTWhy
Delete files inside WinSxS by handLive files are hard-linked to them. You can break Windows, and updates and repairs will fail
Take ownership and change permissions on WinSxSYou remove the protection TrustedInstaller gives it
Use "registry cleaner" or "WinSxS cleaner" toolsThey guess. Guessing here can make Windows unbootable

The supported way. Microsoft provides the cleanup through DISM:

DISM /Online /Cleanup-Image /StartComponentCleanup

This is a real change to your system: it removes old versions, which means you can no longer roll back to them. It is safe when done by Windows itself, but we do not run it in this chapter's lab. Knowing it exists is enough. There is also a "Windows Update Cleanup" tick box in the Disk Cleanup tool and in Settings → System → Storage → Temporary files. They use the same supported mechanism.

A related option, with a warning. DISM also has a /ResetBase switch that makes all current updates permanent, so they can never be uninstalled. Treat it as an advanced tool. Do not use it casually.

When might cleanup help? Only when you are really short of disk space, and after you have tried other things first (Chapter 20: empty the Recycle Bin, remove unused apps, use Storage Sense). The store usually takes a few GB to over ten GB, and that is normal.

5.3 How It All Connects

IdeaWhere you met itHow it fits here
Hard linksChapter 19System32 names point into WinSxS
Side-by-side versionsChapter 22Several component versions coexist
System foldersChapter 21WinSxS, System32, SoftwareDistribution
ServicesChapter 12TrustedInstaller manages the store
RepairChapter 21sfc and DISM restore live files from the store

Why disk space grows after updates. Each update adds new versions before old ones are removed. So the store grows for a while, then Windows trims it. After a feature update, the extra copy of the old Windows (C:\Windows.old, Section 6) adds many more gigabytes until it is removed.

Summary

TermPlain meaning
Component storeC:\Windows\WinSxS, the warehouse of component versions
Hard linkA second name for the same file data
Live fileThe file in System32 that Windows really uses; a hard link into the store
Side by sideMany versions of a component exist together
Explorer sizeOver-counts because hard links are counted twice
AnalyzeComponentStoreRead-only report; shows the Actual Size
StartComponentCleanupThe supported cleanup (changes the system; not run in the lab)
pending.xmlWaiting changes; never edit