Windows users who have run a disk space analyzer like TreeSize in the last days may have stumbled for the first time upon the Winsxs folder in the Windows directory.
The folder usually has a size of about 5 to 8 Gigabytes on Windows Vista and Windows 7, there are however reports of bigger folders, up to 16 Gigabytes.
Especially Windows XP users who recently switched to Windows 7 may have asked themselves why the size of the folder increased from a few Megabytes to Gigabytes.
Internet search engines and message boards are full with questions about the folder, many users want to know if it is safe to delete the Winsxs folder, if it needs to be included in operating system backups or why it has such an enormous size compared to other Windows folders.
It is important to take a look back in time. Back in Windows 9x, the operating system had troubles with dynamic link libraries, more precisely with different versions of the same dll. There was simply no way to store multiple versions of a dll, which led to incompatibilities and other problems.
Then in Windows ME, Microsoft began to include options to store multiple dll versions using the same name in the operating system. It was not until Windows Vista that this technology was turned into what Vista and Windows 7 users are experiencing today.
If you open the folder in Windows Explorer you will notice a huge folder list, with each folder containing at least one file, but often multiple files. Folders that begin with the same name host different versions of the same dll, there are sometimes five or more folders that host different versions of the same dynamic link library.
Winsxs, stands for Windows Side by Side, referring to the concept of hosting the same files in different versions in the operating system.
The backup folder is displayed as the largest folder in the Winsxs folder, followed by the naturallanguage6 folder and Manifests.
A Technet blog post by Jeff Hugh explains the move from an INF described OS to componentization in Windows Vista.
All of the components in the operating system are found in the WinSxS folder – in fact we call this location the component store. Each component has a unique name that includes the version, language, and processor architecture that it was built for. The WinSxS folder is the only location that the component is found on the system, all other instances of the files that you see on the system are “projected” by hard linking from the component store. Let me repeat that last point – there is only one instance (or full data copy) of each version of each file in the OS, and that instance is located in the WinSxS folder. So looked at from that perspective, the WinSxS folder is really the entirety of the whole OS, referred to as a "flat" in down-level operating systems. This also accounts for why you will no longer be prompted for media when running operations such as System File Checker (SFC), or when installing additional features and roles.
Jeff's post gives an answer to the question if it is safe to delete files in the winsxs folder, in short: It is not.
The only option to reduce the file size of that folder safely is to remove software from the operating system that is not needed anymore, but even that won't drop the file size considerably.
The only way to safely reduce the size of the WinSxS folder is to reduce the set of possible actions that the system can take – the easiest way to do that is to remove the packages that installed the components in the first place. This can be done by uninstalling superseded versions of packages that are on your system. Service Pack 1 contains a binary called VSP1CLN.EXE, a tool that will make the Service Pack package permanent (not removable) on your system, and remove the RTM versions of all superseded components. This can only be done because by making the Service Pack permanent we can guarantee that we won’t ever need the RTM versions.
It is best to leave the folder alone. Windows Vista users may be able to reduce the size of the Winsxs folder by running a third party application WinsxsLite
WinsxsLite is meant as a tool to help reduce the size of winsxs in Vista.
WinsxsLite is split into two phases.
The first phase searches the Program Files and Windows folders for files,
that are exactly identical to files in the winsxs folder.
The second phase replaces all the old versions of each file in winsxs,
with hardlinks to the highest version file.
So, it will still seem like there's, say, 16 different versions of a
particular file, but in reality, there's only one data object pointed to
by 16 directory entries.
Additionally, unused localized files can be eliminated, by replacing them
with hardlinks to the corresponding files in other languages.
Note: Both phases are optional.
Note: If Vista SP1 is installed, make sure vsp1cln.exe has been run.
It is highly advised to create a system backup before running WinsxsLite, considering that the software makes irreversible changes to the Windows system partition that can only be undone by a backup.
The latest version of the program is always available at the Google Code project website. The site links to a Rapidshare download location, we have taken the liberty to upload the latest file to our servers as well. You can download the 20K tool below: WinsxsLite1.86
Please note that it is only compatible with Windows Vista, and not Windows 7.
Windows Vista users with the Service Pack installed can furthermore run the VSP1CLN command-line tool to remove files that are not longer needed after the service pack has been installed. Please note that these files are needed for uninstalling the SP in Vista.
Do you have additional tips on reducing the size of the Winsxs folder? Let us know about them in the comments.
Update: Recent information indicate that the Winsxs folder may in fact not be as large as it is reported by the system, and the main reason for that is that many of the files in the folder are hard links pointing to files elsewhere on the system.
“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 when using the built-in tools (DIR and Explorer) to measure disk space used. The fact that we make it tricky for you to know how much space is actually consumed in a directory is definitely a fair point!
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.”
More information about that is available on the Engineering Windows 7 blog.