Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

A Vista virtual machine I use only has a 10 GB virtual hard disk -- and I'm worried about it running out of space over time.

I used TreeSize to check for the culprits..

enter image description here

And the primary culprit is that /winsxs or "Windows Side-By-Side" folder.

enter image description here

What is the Windows Side By Side folder? Well, that's explained pretty well here.

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.

That explains why the folder starts off big, but not why it gets larger over time – the answer to that question is servicing. In previous versions of Windows the atomic unit of servicing was the file, in Windows Vista it’s the component. When we update a particular binary we release a new version of the whole component, and that new version is stored alongside the original one in the component store. The higher version of the component is projected onto the system, but the older version in the store isn’t touched. The reason for that is the third part of why the component store gets so large.

Lots of other people complaining about the size of the /winsxs folder, too:

A coworker recently received his every two year work laptop refresh and was in the middle of loading his new laptop with Vista. For some reason, his hard drive C: was partitioned to only 25GB and the rest of the space reserved for a much larger drive D:.

Anyway, after loading many Windows Updates, he was left with hardly any drive space left on C:, and for some reason, the WinSxS directory had ballooned to over 8GB.

While I knew what the WinSxS (Windows Side-by-Side) directory was for, I wasn't quite sure why that directory would explode in size so fast with normal operating system updates.

I don't really care about having all these duplicate files for safety, but I do care about the VM exploding due to an out of disk space error. So.. can /winsxs be safely pared down in any way? It doesn't seem that it can be..

Administrators should not, for any reason, take it upon themselves to clean out the /winsxs directory - doing so may prevent Windows Update and MSI from functioning properly afterwards. Preventing accidental deletion from the directory is accomplished by putting a strong security descriptor on the directory that inherits to its children.

If this /winsxs folder gets any larger, I'm going to have to re-image this virtual machine.. which I really don't want to do!

share|improve this question
21  
TreeSize Free... I use windirstat.info for this purpose ;-) –  Steve Schnepp Jul 15 '09 at 7:45
4  
Can't you grow the VM and extend the main partition? –  Sam Saffron Jul 15 '09 at 8:52
1  
You could use this: windowsfixup.com/2009/05/… personally I would stay away from it unless I could find the source code –  Sam Saffron Jul 27 '09 at 8:03
10  
There are a lot of hard links in winsxs, so the size is also frequently over-reported. –  Greg D Jul 31 '09 at 13:58
1  

10 Answers 10

There is a nice command that cleans up after a Windows 7 SP1 installation (it saved me around 3 GB):

DISM /online /cleanup-Image /spsuperseded

Must be executed from an elevated command prompt

share|improve this answer
15  
thanks for saving 3GB worth of precious SSD space! –  Ivo Flipse Apr 20 '11 at 7:38
3  
are there other commands for Windows 7 that can also remove non-SP update backups? –  galacticninja Apr 24 '11 at 3:42
8  
Alternatively you can use the "Cleanup system files" option in the Disk Cleanup tool and delete the Service Pack backup files. –  Pies Mar 30 '12 at 14:16
5  
@Pies, I ran Disk Cleanup first and DSIM still got rid of an extra ~3GB (measuring %free disk space, not folder size). So it's worth doing both. –  matt wilkie Nov 2 '12 at 21:00
3  
@UpTheCreek, you sure? After doing Disk Cleanup, Clean up system files, i get C:\Windows\system32>DISM /online /cleanup-Image /spsuperseded Deployment Image Servicing and Management tool Version: 6.1.7600.16385 Image Version: 6.1.7600.16385 Service Pack Cleanup can't proceed: No service pack backup files were found. The operation completed successfully. –  Cees Timmerman Jun 5 '13 at 14:59

If you have Vista and have SP2 installed, you can clean up old system files with the new Service Pack Clean-up Tool.

  1. Click Start>All Programs>Accessories>Command Prompt or click Start>Run and type cmd to open Command Prompt Windows
  2. Execute the command “Compcln.exe”. The path is “c:\Windows\System32 \compcln.exe”.
  3. Users will be prompted a question whether to keep Vista SP2 permanently in the system.
  4. Type “Y” and press enter, the system will start performing the windows components clean.
share|improve this answer
    
I couldn't locate this in my Vista SP1 –  pencilslate Feb 16 '10 at 15:44
    
Yeah it's probably new in Vista SP2. –  TomA Mar 6 '10 at 0:48
4  
Didn't save so much for me, but I can confirm that the tool exists and it saved me a G plus –  itj Apr 5 '10 at 20:45

TL;DR

winsxs actually contains hard links (which are kind of like 'shortcuts level 2') -- it does not take up as much additional data as you think. (You would not gain as much space as you think if you delete it.)


winsxs is not a problem

...it's a solution! (Well, mostly.)

A summary, "Marked As Answer by Ronnie Vernon, MVP, Moderator", says here:

Wow, long discussion about hardlinks and winsxs. Anyway here are some summarized points of what I understood about how all of it works.

To start by answering the OP's question with the perfect answer posted above by Andre.Ziegler, you don't touch winsxs. Maybe some of the files can be trimmed like the mp3's, avi's, etc but the rest of the system files should be left alone. I too am using Link Shell Extension as posted above by Ronnie Vernon, easy way to see which are hard linked (red arrow) and which are simple files.

Before getting here I saw in a lot of places people asking for the cleanup tool after installing SP1 for Windows 7 like vsp1cln. There is no dedicated tool, it all got integrated into the Disk Cleanup service. One note that I would make here is that even if the option says it will remove a few hundreds of MB after I cleaned up my drive the service removed around 3GB of excess files, so it varies from system to system. Funny, now I have even more space than I had before installing SP1. Nice one, MS.

Regarding the hard links, I got amused by the confusion created around them. I'm not a linux geek, and I usually use only soft links... they're enough for me, but people didn't get how the hard ones work and how size is counted.

A group of selected files, links or not, will always be counted as a sum. This means that if I take a 10MB file, and make 2 hard links, the selection of all three of them will have 30MB and this is the correct size, because unlike the soft links which are related to the file's original Master File Table entry and have 0 bytes, hard links are related to the data itself, have their own entry in MFT but point to the same data address, obviously having as size the size of the actual data, same times, attributes and so on. Why, below.

How much is left on the drive? Simple: exactly as much as the drive's own properties reports. Don't go selecting all the files, hidden and non hidden on C and making comparisons, or using tools that do that automatically because it won't show the actual HDD usage. Why? Because: 1. that operation makes a list of all the selected files including hard links as separate files, takes each of them and adds the sizes up, the drives properties counts the actual stored data 2. not all the files will be counted, folders protected from traversing and files from reading will not be counted and the System Volume Information usually has very large files protected just in this manner 3. that number is useful only in cases of file transfer, if the files, links, etc need to be copied to DVD or NAS, that's how much they would occupy, and the links will not be preserved since they are NTFS specific features, not available or available in different forms under ISO, UDF, NFS and other file systems, but they will be cloned.

Make a test... copy a 10MB file, a.exe, from a different drive and notice how the free space drops by the 10MB. Make a hard link (mklink /H b.exe a.exe). Now these two files selected will "use" 20MB in the selection properties, but actually only 10MB verified at the drive's properties, which will have the same free space as it did/does after the file copy. Delete one, either one, the free space will remain the same. Now delete the last one and the space will increase by 10MB. Was there any harm done? NO.

What is winsxs? A much better dllcache. Where with the dllcache in XP we had copies of files that actually added to the size usage since they were cloned, this actually improves usage but not total protection (against viruses). If a rogue uninstaller thinks it has to remove some runtime libs from System32, it would only delete the links, but not the data, then the links would be recreated while keeping data space usage at lowest possible, better than archiving winsxs in cabs and having the cabs along side the original files. Also winsxs bring serialization, compartmentalizing files with the same name but different version, for the dev's sake, which is a good thing / bad thing, it makes them lazy to code properly but it helps when they don't want to code anymore.

I did this to help anyone that lands here out of the same reasons I did... excessive "usage of space" by winsxs after SP1. And I hope it was helpful.

share|improve this answer

These duplicates and backups are extremely annoying when having limited disk space. Being in that place, the only way I found that would not jeopardize the OS stability was to generously use the "Compress contents to save disk space" setting. By compressing all those backup directories under the Windows directory, I was able to reduce the directory size from 6.5 GB to 5 GB, with no recognizeable side effects. Using it on some of your stuff outside the Window directory would stretch your 10 GB even more.

share|improve this answer
2  
I tried compressing it and i says "Access denied" to the folder and then poqexec.log. Assumed it was a read lock. Anything to bypass this? –  Quintin Par Sep 15 '09 at 6:41
1  
Actually, you're still jeopardizing your OS's stability. The WinSxS folder should NOT be compressed. In fact, it's quite a bad idea. Just google 'compress winsxs' and you'll find out. –  Hello71 Jun 13 '10 at 15:15
    
@Hello71: Please note that he is compressing the back-up folder only. –  Tom Wijsman Jan 23 '11 at 0:32
4  
I'm not sure that this technique is a good idea -- many files in the winsxs tree are hard-links. Will enabling compression on these files compress all instances of the file? There could be some unintended performance consequences. –  duffbeer703 Dec 9 '11 at 17:41
2  
@FiascoLabs, have you noticed this is a 4 year old question, which specifically refers to a 10GB drive? You could just as well state that "nobody uses Vista". It might be true now, but wasn't so at the time the question was asked. –  eran Jun 22 '13 at 14:01

You could use VSP1CLN.EXE to make SP1 permanent, which according to this page will free up superseded-by-SP1 components.

share|improve this answer
5  
These guys shed 7GB with this tool: bit-tech.net/blog/2009/07/24/… –  hyperslug Jul 26 '09 at 17:01

In Windows 8 you can reduce the size of the WinSxS folder by removing Windows Features:

DISM.exe /Online /Disable-Feature /Featurename:<name> /Remove

The important thing is the /Remove parameter which is new to Windows 8.

The most space in WinSxS is used the WindowsUpdates which you install over the time. In Windows 8 you can detect and remove Updates which are replaced by newer updates (like newer cumulative IE Updates) be running this command:

dism.exe /online /cleanup-image /startcomponentcleanup

or running the disk cleanup wizard and select "Windows Update Cleanup"

enter image description here

enter image description here

enter image description here

Also make sure you've installed the servicing stack update http://support.microsoft.com/kb/2821895.

This updates run an in deep cleanup of WinSxS and compresses all DLLs/Exe files, from WinSxS which are not currently in use, into smaller delta file:

enter image description here

Look at the different file sizes.

Windows 8.1 adds new DISM commands. The /startcomponentcleanup gets a new parameter /ResetBase which makes your last Update permanent and removes all older files to save more space.

You can also run a new command dism /online /cleanup-image /analyzecomponentstore to analyze the WinSxS folder:

enter image description here

It tells you now when you should run the cleanup to save space.

share|improve this answer
2  
This is now available for Windows 7 SP1 as well: support.microsoft.com/kb/2852386 –  Mark Henderson Oct 9 '13 at 0:54

Good news! There is now an officially sanctioned method, from Microsoft, for Windows 7 SP1, to clean out your WinSXS folder.

  1. Install HotFix 2852386 - you can either download manually, or wait for it to come through your Windows Update
  2. This adds a new option to the Disk Cleanup Wizard (Under Clean Up System Files) that you can enable for "Windows Update Cleanup". Tick this option.
  3. Click OK

Caveat: You may be unable to un-install certain Windows Updates after running the cleanup of your WinSxS folder.

share|improve this answer
up vote 5 down vote accepted

Looks like there is finally a way to do this in Windows 8.1 service pack 1 and Windows Server 2012 R2.

Component store analysis tool:

Dism.exe /Online /Cleanup-image /AnalyzeComponentStore

At the end of the scan, the user gets a report of the results (actual size of the winsxs folder) like this:

analyzecomponentstore results

Component store cleanup:

Today, Component Store Cleanup must be triggered manually by an end-user, either by running DISM, or by using the Disk Cleanup Wizard. In order to make Component Store Cleanup more useful for the average end-user, it will be added into a maintenance task, automatically saving disk space for end-users. To enable this, a change will be made to allow uninstallation of superseded inbox drivers without requiring a reboot (today, all driver installs/uninstalls done by CBS require a reboot).

  1. Dism.exe /online /Cleanup-Image /StartComponentCleanup

  2. Disk Cleanup tool, Clean up system files button.

    disk cleanup tool

  3. schtasks.exe /Run /TN "\Microsoft\Windows\Servicing\StartComponentCleanup"

share|improve this answer
1  
already posted way ago: superuser.com/a/594216/174557 No need to post the same thing twice ;) –  magicandre1981 May 5 at 4:13

There is a program that can reduce the size of Winsxs, use at your own risk

About the program

Now this post we written to introduce the first ever Third party application to help you with the problem if WinSXS problem, and it is called WinSXSLite. It is one Batch file written by Christian Bering Boegh and available for download at their Google Code site.

Before running the WinSXSLite, we personally advise that you take a full system backup of your windows partition by using any of the backup utility. I use CloneZilla for this because it is free and Open Source. Once Backup is taken you can run.

WinSXSLite is split into 2 phases, the first phase will search the files which are identical in size with the files stored in WinSXS folder and as per program can be removed. This is required because with a lot of Files backed up by MS Windows are actually not changing but stored as backup in WinSXS folder and resulting in huge size of Folder.

Second Phase will replace all version of each and every file stored in WinSXS folder and will create hard link to highest version of file in program location or other location. So that if any other program look for File it can be found and at the same time There is no actual file but only Directory entries for the file.

This way we can remove the files after making hard links and Still MS windows will think that it has the file backed up in WinSXS folder. Only disadvantage of this process will be that you can restore back your System files, but that you anyway don’t want if you need space recovered, because for having restoration utility to work you must have back up copy.

Program Download

share|improve this answer
1  
Er... WinSxS contains hardlinks to the files. They don't take up any additional space compared to the "other" copies of the files elsewhere on the disk... –  Mehrdad Mar 5 '12 at 7:21
    
Er.. it answered the second part of the question " and can it be made smaller?" picky picky picky –  Moab Apr 1 '12 at 15:47
    
Seems a bit sketchy. Also it's not on Google Code, and the link to the batch file is not available either. –  Ehtesh Choudhury Oct 9 '13 at 1:11

You can remove those files safely. If you ever need them again it will just require you to install a few more things.

Now on to the fix!

  • Open Windows Explorer and navigate to C:\Windows\System32. Look for the file "vsp1cln.exe."
  • Right click this file and select the 'Run As Administrator' option.
  • The Vista Service Pack 1 Cleanup Tool will remove all of the redundant files that it has replaced.

The amount of disk space you gain will depend on the system, what programs are installed, etc.

share|improve this answer
12  
You can safely remove winsxs files? Are you sure about that?! –  UpTheCreek Jan 21 '11 at 8:53

protected by slhck May 16 '12 at 7:46

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.