News Trending

How to Manage the Huge WinSxS Folder in Windows 10

ad+1

winsxs-windows10

When your system disk space gets low, third-party utilities help you spot large files and collections of smaller files at a glance. That’s where you might stumble upon the WinSxS folder. It has a size of almost 5–10GB, and for many users, it’s like a black box in the Windows world.

Naturally, it raises the question of what exactly are those files installed in WinSxS and why it’s so huge. Web searches and forums are full of questions about this folder. Let’s demystify the secrets of WinSxS and the correct way to manage it.

WinSxS Explained

WinSxS (Side-by-Side) was created in response to solve the “DLL Hell” problem in Windows OS. In simple terms, it involves instances when any program alters the dynamic link library (DLL) file to affect the critical function of other applications that need to use the same DLL.

For example, assume that an app requires a DLL with version number 1.0.2. If another app replaces the resource with a different version, say 1.0.3, then the previous app which relies on version 1.0.2 will either crash, cause compatibility issues or worse result in the Blue Screen of Death.

Launch of WinSxS

Windows XP saw the proper launch of the component store. In this, each component (DLL, OCX, EXE) lives in a directory called WinSxS. It would store all the different versions of DLLs installed by software and hardware packages and load the correct version on demand.

So how does an app knows what version of a DLL it needs to load? This is where the “manifest file” plays an important role. It contains settings that inform the operating system how to handle a program when it starts and the correct version of DLL.

Each component has an identity with a unique name that may include processor architecture, language, version, and ID. Specific versions of these components are then collected together into packages. They’re used by Windows Update and DISM to keep your system up-to-date.

winsxs component packages in windows 10

This timeline shows a progressive improvement of WinSxS with each major OS upgrade.

timeline of winsxs improvement in Windows OS

The WinSxS Folder and the Role of Hard Links

Hard links are used throughout the Windows OS. In terms of WinSxS, it’s the only location where components live on the system. All the other instances of the files outside the component store are hard-linked to the WinSxS folder. So, what is a hard link?

According to Microsoft Docs, a hard link is a file system object which allows two files to refer to the same location on disk. It means that Windows can keep multiple copies of the same file without taking any extra space.

Whenever you update Windows, a whole new version of the component gets released and projects into the system through hard links. The older ones remain in the component store for reliability but with no hard links.

With the help of fsutil command, you can check the hard links of any system file. Press Win+X and choose Command Prompt (Admin), then type in

fsutil hardlink list [system file path]

For example, if I want to check the hard links of a system file called “audiosrv.dll,” then type in

fsutil hardlink list "C:\Windows\System32\audiosrv.dll"

fsutil hardlink list in command prompt

Importance of WinSxS

The component store plays a vital role in supporting the functions needed to customize and update Windows. These are as follows:

  • Recover your system from boot failure or corruption
  • Enable or disable Windows features on demand
  • Move systems between different Windows editions
  • Uninstall problematic updates
  • To install the new component versions using Windows Update

WinSxS Folder Size

WinSxS contains all the files necessary to maintain compatibility with hardware and software on your PC. One of the biggest strengths of Windows is its capacity to run older hardware and apps. But this legacy compatibility comes at the cost of disk space and bugs.

Navigate to the C:\Windows\WinSxS, right-click it and choose Properties. This folder consumes almost 7.3GB of disk space. But the thing is, that’s not the real size. The reason for that is “hard links” that File Explorer and other third-party tools don’t consider.

It counts each reference to a hard link as a single instance of the file for each location. So, if a system file resides in both WinSxS and System32 directory, File Explorer would inaccurately double the folder size.

winsxs folder size in Windows10

Check the Actual Size of WinSxS

To check the Windows component store’s actual size, open an elevated command prompt window and type in

Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore

Note: The /AnalyzeComponentStore option isn’t recognized on Windows 8 and earlier.

After the analysis, the actual size of the component store comes down to 5.37GB. This value factors in hard links within the WinSxS folder. Shared with Windows gives you the size of hard-linked files. Date of Last Cleanup is the date of the recently completed component store cleanup.

analyze the size of the component store in Windows10

Methods to Reduce the Size of the WinSxS Folder

Many users often ask if it’s possible to manually delete the files from the WinSxS folder. The answer is a Big No.

It will most likely damage Windows and critical Windows Update may fail to install properly. Even if you’re successful in removing files from the WinSxS folder, you never know which app will stop working.

You can though reduce the size of the WinSxS folder with a few in-built tools. We’ll use tools like Disk Cleanup, DISM commands, and remove Features on Demand to trim the WinSxS folder.

Disk Cleanup Tool

In the search box, type in disk cleanup, and select Disk Cleanup. From this window, click the Clean up system file button. That restarts the utility and unlock access to the full range of cleanup options. You can remove installation files, previous Windows versions, and more. Disk Cleanup tool is the starting point for cleaning up Windows 10.

disk cleanup tool in admin mode

Read this step-by-step guide to find out the best ways for cleaning Windows 10.

Remove Features on Demand

Windows lets you enable or disable default Windows features on demand. You can add some useful features—Hyper V, Print to PDF, Windows Subsystem for Linux (WSL), and more.

Features that you uncheck remain in the WinSxS folder and take up disk space. Users with a low amount of storage might want to slim their Windows installation as much as possible. Open an elevated command prompt window, and type in

DISM.exe /Online /English /Get-Features /Format:Table

You’ll see a list of feature names and their status

windows feature on demand list

To remove a feature from your system, type in

DISM.exe /Online /Disable-Feature /featurename:NAME /Remove

(Replace “NAME” with the name of the feature mentioned in the list)

remove a windows feature with DISM

If you run the /Get-Features command again, you’ll see the status as “Disabled with Payload Removed” instead of just “Disabled.” Later on, if you choose to install the removed components, Windows will prompt you to download the component files again.

DISM Component Cleanup

Windows 8/8.1 includes a built-in feature to automatically clean up the component store when the system is not in use. Open Task Scheduler and navigate to Microsoft > Windows > Servicing. Right-click the item and click Run.

startcomponentcleanup parameter in task scheduler

The task will wait at least 30 days after an updated component gets installed before uninstalling the previous version of the component. The task also has a one hour timeout and may not clean up all the files.

With DISM /Cleanup-Image parameter, you can immediately remove the previous version of the component (without a 30 day grace period) and do not have a one hour timeout limitation. Open Command Prompt (Admin) and type in

DISM.exe /online /Cleanup-Image /StartComponentCleanup

If you add ResetBase switch, you can remove all the superseded version of every component. But remember, you’ll not be able to uninstall any current updates (even if they’re faulty).

DISM.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase

The following command will remove any backup components needed for the uninstallation of service packs. It’s a collection of cumulative updates for a particular release of Windows.

DISM.exe /online /Cleanup-Image /SPSuperseded

Delete Windows Files to Free Up Disk Space

WinSxS component store has an important role to play in the day-to-day functioning of Windows. So you shouldn’t delete the files, or move the WinSxS folder as a solution to your space problems. Windows upgrades have brought in-depth reporting and cleanup tools you can use to find the other space hogs instead.

If you follow the techniques as described above, you can reduce the size of the WinSxS folder slightly. Read this piece to find out Windows files and folders you can delete to further free up disk space.

Read the full article: How to Manage the Huge WinSxS Folder in Windows 10



from MakeUseOf https://ift.tt/2Xd6pMG
via IFTTT

0 comments: