Last year I wrote a post where I explained what the Winsxs folder was and which were the possible solutions to contain its bad habit of eating free space on your hard drive. Some days ago I have discovered that, starting from Service Pack 1, Windows 2008 R2 (... and Windows 7) finally has a built-in tool to reduce the size of the Windows Side-by-Side DLL repository and free up some GBs on your server storage. This tool is DISM.exe.
Cool news isn't it? Personally I am happy to know that someone at Microsoft has finally decided to make it possible to reclaim a few GBs on the system partition and to partially solve this major bug.
- Start and elevated command prompt (run 'CMD' as administrator) and ...
- Run the DISM command, which replaces the old VSP1CLN and COMPCLN we used on previous Windows versions: DISM.exe /online /Cleanup-Image /spsuperseded
- Wait 10 minutes before the task completes ( it ends with “Service Pack Cleanup operation completed. The operation completed successfully”)
Normally you should have been able to reduce the Winsxs folder size by 1 or maybe 2 GBs, sometimes more. Saved space may vary a lot.
Just know that after using DISM you will not be able to uninstall the Service Pack 1 anymore.
- The /online switch tells DISM to work on the running OS installation
- The /spsuperseded option removes the backup files created during installation.
Optionally you could use the /hidesp option which will remove SP1 (KB976932) from the “Installed Updates” section of Programs and Features, to ensure that users do not try to uninstall the Service Pack.
I hope this helps. Please let me know how much disk space you were able to free up using the given command.
I hope this helps. Please let me know how much disk space you were able to free up using the given command.
Can you remove the backup files of hotfixes/updates?
ReplyDeleteNote: A space is needed after the "/online" switch in "DISM.exe /online/Cleanup-Image /spsuperseded"
ReplyDeleteThanks!!
Thanks so much for this. I've spent a while trying to find where VSP1CLN or COMPCLN were in Server 2008 R2, because I couldn't find them. Finally I found your post about using DISM to remove old files. I ran it on my server and freed up about 3 gig of space! Thanks again!
ReplyDeleteI only was able to clean up 600 MB... Still 9 GB left in winsxs... :(
ReplyDeleteI was pleasantly surprised to clean up about 4GB. I went from 9.7 GB to 5.7GB. Thanks!
ReplyDeleteBrilliant. I managed to clear up 2.7 GB of space :)
ReplyDeleteSeems that /spsuersceded and hidesp are not good options. Note also that typing dism /? (for help) doesn't show /Cleanup-Image as an option. Shoddy work MS.
ReplyDeletePS C:\Windows\system32> dism.exe /online /Cleanup-Image /spsuperseded /hidesp
Deployment Image Servicing and Management tool
Version: 6.1.7600.16385
Image Version: 6.1.7600.16385
Error: 87
The spsuperseded option is not recognized in this context.
For more information, refer to the help.
The hidesp option is not recognized in this context.
For more information, refer to the help.
The DISM log file can be found at C:\Windows\Logs\DISM\dism.log
C:\Windows\system32>DISM.exe /online /Cleanup-Image /spsuperseded /hidesp
ReplyDeleteDeployment Image Servicing and Management tool
Version: 6.1.7600.16385
Image Version: 6.1.7601.17514
Removing backup files created during service pack installation.
[==========================100.0%==========================]
Service Pack Cleanup operation completed.
The operation completed successfully.
This cleaned up 1.5Gb on my desktop machine.
Thanks for the post!
Lexas
The help is context sensitive. Use:
ReplyDeletedism /online /Cleanup-Image /?
to see the spsuperceded and hidesp options.
Got back about 4 Gigs - was 11184MB, now 6813MB
ReplyDelete(Win2008R2)
Thanks
I have windows 2008 Enterprise Service pack 2, but dism command is not working, it says it is not internal or external command
ReplyDeleteDid you start the dism command from an elevated command prompt? Otherwise UAC is probably preventing this action.
ReplyDeleteCheck this:
http://www.happysysadm.com/2011/11/windows-2008-r2-folder-security-issue.html
I have windows server 2008 SP2, when I am running
ReplyDelete"dism /online /cleanup-image /spsuperseded", its giving error:
Error: 50
DISM does not support servicing Windows Vista or Windows Server 2008 with the /O
nline option.
No such option...
ReplyDeletec:\Windows\System32>DISM.exe /online /Cleanup-Image /spsuperseded
Deployment Image Servicing and Management tool
Version: 6.1.7600.16385
Image Version: 6.1.7600.16385
Error: 87
The spsuperseded option is not recognized in this context.
For more information, refer to the help.
The DISM log file can be found at C:\Windows\Logs\DISM\dism.log
c:\Windows\System32>DISM.exe /online /Cleanup-Image /?
Deployment Image Servicing and Management tool
Version: 6.1.7600.16385
Image Version: 6.1.7600.16385
/Cleanup-Image /RevertPendingActions
WARNING! This operation will revert pending actions from previous servicing
operations. It should be used for recovery operations only. This command
is not supported against an online image.
Example:
DISM.exe /Image:C:\test\offline /Cleanup-Image /RevertPendingActions
error 87 appears to mean: SP1 isnt on the installed list.
ReplyDeletebest to check your list of installed updates to see it is actually there.
Hi,
ReplyDeleteI confirm, this command ONLY works with SP1 installed (it is not available with no SP installed and obviously you don't need it if you don't have SP installed...)
Thank you, it worked well.
ReplyDeleteBefore
Size on Disk 11.9GB
Files 59,264
Folders 15,744
After
Size on Disk 6.16GB
Files 42,707
Folders 11,180
Any option to remove old hotfixes or security updates after SP1 or is this just for SP1.
ReplyDeleteGood question. I also ask myself the same question.
ReplyDeleteOther question is, does this only work on Windows 7 and Server 2008 R2, or also on Server 2008 Enterprise 32-bit / 64-bit?
safed me 5.1 GB !
ReplyDeleteReduced size from 13GB to 6GB Allen Suski
ReplyDeleteThanks for you feedback, Allen!
DeleteAll good here, worked like a charm - managed to shave 4GB off my winsxs file alone!
Deletei5-2500k, 3.3GHz, 8GB Ram, Kingston SSD, Win 7 Pro (64-bit).
John (UK)
Thank you! winsxs reduced by over 5 Gigs!!! 2008 R2.
ReplyDeleteRan elevated cmd (as Administrator), copy/pasted your command line in from above, and voila +2.2GB!
ReplyDeleteThanks, much appreciated.
Saved 2.3GB! Thanks!
ReplyDeleteOMG!!!!!
ReplyDeleteBefore: 300 mb
After: 14 mb
Why!?!?!?!? What happened??
Saved 4.5 Gigs of space on the first Hyper-V Guest I tried it on. Assuming it stays stable during testing, 44 more to go!
ReplyDeleteThanks a lot. Saved almost 7Gb. Works fine
ReplyDeleteOld size: 12.7G new size: 7.3 G
ReplyDeleteAwesome - went from 1.56GB to 6.28 Win2k8 R2.
ReplyDeleteThank you
locked by winsxs
ReplyDeletepreviously 9,174.2 MB
now 6,526.5 MB
so 2647.7 MB spared
Thanks for this lovely command.
--
As this additional question is asked above by others, I repeat ask it: - does it just removes W7SP1 or there are methods to remove all windows updates and other updates (say, done by WUD Windows updates downloader)? I don't want to keep so much space locked in updates backup files, even if deleting them means I will never be able to revert to older version.
Please tell the method to remove all updates backups.
Thanks.
Rawat
India
I cleaned up 4.5g of space on a 40g drive. Thanks a bunch!
ReplyDeleteNice, 4,45 GB
ReplyDeleteThank's
I guess no option to remove unneeded backups of hotfixes and updates.
ReplyDeleteMy WINSXS is at a wopping 11GB! And that's after removing the SP1 backups.
This has worked great for my 2008 R2 Standard SP1 virtual with the following message:
ReplyDeleteDeployment Image Servicing and Management tool
Version: 6.1.7600.16385
Image Version: 6.1.7600.16385
Removing backup files created during service pack installation.
Removing package Microsoft-Windows-ServerEnterpriseEdition~31bf3856ad364e35~amd64~~6.1.7600.16385
[==========================100.0%==========================]
Service Pack Cleanup operation completed.
The operation completed successfully.
The WinSxS size has gone down from 11275.3 MB to 7237.4MB
@mandrew2000
DeleteThanks for sharing your results and glad I could help!
I don't understand why it works for some and not others.
ReplyDeleteBefore: 1.5 gig ram. After: 4.47 gig. Cleared nearly 3 gigs. Thanks a million!
ReplyDeleteI managed to free up 3G, yay
ReplyDeleteI moved that folder to another partition. My server is Windows 2008 R2, and is DC. Here's the steps:
ReplyDelete1. Logon as administrator. Copy C:\windows\winsxs to z:\windows\winsxs. Drive Z is on a different partition.
2. Create a link for the new folder. In Command Prompt, excute "mklink /j c:\windows\winsxs_1 z:\windows\winsxs". It creates a link with name winsxs_1.
3. Restart the server with Winodws 2008 R2 Installation Disk. When it starts, select Repair your OS, NOT Install. It will pop up the System Recovery Options window. Select the option "Use recovery tools that can help fix problems starting Windows". It lists the OS installed on this server. Write down the drive letter. Your C drive may not be C at this time. Mine is drive G. Then click Next.
4. Use Command Prompt. Go to the drive that your OS was installed. And go to Windows folder. Rename Windows\winsxs to be winsxs_original. Rename the link windows\winsxs_1 to be winsxs.
5. Exit the command windows, and restart the server.
6. Logon as administrator. Find windows\winsxs_original. Take ownership. And grant administrator to have full control.
7. Restart the server again. When it's fully started, try update/install/uninstall. And then check which folder has been updated. In my case, z:\windows\winsxs is updated. That means the OS is using the new location. Now you can delete c:\windows\winsxs_original.
The WinSxS size has gone down from 13,4 GB to 9,0 GB...
ReplyDeleteGain 4,4 GB
wau, 10 GB free
ReplyDeleteI get the below error. Please advice.
ReplyDeleteC:\Users\Administrator>DISM.exe /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.
30gb was filled on a VM server. DISM freed up about 5GB.
ReplyDeleteThanks a bunch!
DISM for Server 2008R2 SP1 whereas we're still stuck with COMPCLN for Server 2008 SP2 and 16GB winsxs directories.
ReplyDeleteFreed up 3 GIGS. Thanks
ReplyDeleteService Pack Cleanup can't proceed: No service pack backup files were found.
ReplyDeleteThe operation completed successfully.
Hello SysAdm,
ReplyDeleteThank you with your posts, i have run the same cmd
winsxs folder is now shrinked from 18Gb to 13 GB ( on win 2008 R2 standard SP1) ,
Question :
1) After sucessful shrink can we install the 2008 R2 SP2 on the server ?
2) we have exchange application on it i.e.( 2010 sp 3 ) can we install exchange 2010 SP 4 on it after shrinking ?
3) there would be any issues after shrinking winsxs folder
Thanks team !
Thanks for this! I was searching in vain for compcln.exe on Server 2008 R2 SP1.
ReplyDeleteIt took close to 20 minutes on my install. winsxs went from 24.7GB down to 19.8GB, so a savings of around 5GB.
this folder on PC from my user is over 400GB on his 500gb hard drive.
ReplyDeleteWhen i try this says same error 87, not recognized in this context.
How can i do this then? Ive try to delete some of folder just like that, but didnt work...
Any suggestion?