Friday, June 15, 2018

Do NOT delete the files in Windows\WinSxS

There is a folder that appears to be quite big when you analyze your drive: Windows\WinSxS. It reports many gigabytes of files. If you are low on space, you might be tempted to delete it. The problem is that the folder is full of hard links to files that are already stored in other places. In order to determine the true size of the folder, run this command with elevated privileges:
dism /online /cleanup-image /analyzecomponentstore
the output looks like this:
Deployment Image Servicing and Management tool
Version: 10.0.16299.15

Image Version: 10.0.16299.309

[===========================99.1%========================= ]

Component Store (WinSxS) information:

Windows Explorer Reported Size of Component Store : 7.03 GB

Actual Size of Component Store : 6.94 GB

    Shared with Windows : 6.06 GB
    Backups and Disabled Features : 687.18 MB
    Cache and Temporary Data : 194.21 MB

Date of Last Cleanup : 2018-06-15 01:02:45

Number of Reclaimable Packages : 0
Component Store Cleanup Recommended : No

The operation completed successfully.
The actual size used is the one in bold: 687.18 MB.

Deleting the folder or the files inside it will break your machine. Moving the files and copying them back will delete the hard links (freeing no space) then copy actual files instead, wreaking havoc with your system.