Relocating the winsxs folder

Adam LewisSr. Network Anaylist
Published:
Updated:
Update 11/3/2014 - Although the below article will get you to relocate the WINSXS folder, Microsoft has finally released a utility to reduce the size of the WINSXS folder. For some reason, it's not that straightforward. It only works on Windows 2008 and above (those are the only OS's affected by the large WINSXS folders)

In a recent update, MS has updated the disk cleanup wizard (cleanmgr.exe) on Win 2008 x86, Win 2008 x64, & Win 2008 R2. I'm not sure about desktop OS's, but I would assume they got the update too.

The new cleanmgr.exe has an option to clean up windows update files. This will clean out Gigabytes from the WINSXS folder (although not everything). You will not see a gain in space until you reboot the machine. When you reboot after running the cleanmgr.exe utility, it will come up like it had just applied updates, with the Screen 'Configuring WIndows Updates ... Do not power off your computer'. After the reboot you will see the size of WINSXS has been greatly reduced. I've got back anywhere from 2 to 10 GB.

The funny thing is that although the new cleanmgr.exe will exist on your computer if you've been keeping up with windows updates, it's not readily available unless you move some files around. Follow the instructions below to put the cleanmgr.exe and related files in the proper place and then you can run them:

The location of the files you need to copy depend on your version of Windows: Execute the copy command based on the appropriate version

Windows Server 2008 R2
 64-bit
copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe %systemroot%\System32
copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63\cleanmgr.exe.mui %systemroot%\System32\en-us
cleanmgr.exe
 
Windows Server 2008
 64-bit
copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.0.6001.18000_en-us_b9f50b71510436f2\cleanmgr.exe.mui  %systemroot%\System3
copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_c962d1e515e94269\cleanmgr.exe.mui %systemroot%\System3\en-us
cleanmgr.exe
 
Windows Server 2008
 32-bit
copy C:\Windows\winsxs\x86_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.0.6001.18000_en-us_5dd66fed98a6c5bc\cleanmgr.exe.mui %systemroot%\System3
copy C:\Windows\winsxs\x86_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_6d4436615d8bd133\cleanmgr.exe %systemroot%\System3\en-us
cleanmgr.exe

You can now launch the Disk cleanup wizard by running Cleanmgr.exe from the command prompt or Start > Run.

************************************************************************************

I've seen a few articles about moving the \Windows\winsxs folder. Most of these involve using third-party utilities to do pending moves and pending renames on reboot. I've found a simpler way that requires no addittional utilities. Thanks to those folks who developed those methods using the utilities, as it got me started on developing this simpler method.

Winsxs is short for 'Windows Side by Side' It allows for the hosting the same files in different versions in the operating system. The folder and it's contents are necessary for the normal operation of your computer. You should NOT simply delete or move this folder. In testing, I did blue-screen a machine by making it's winsxs folder unavailable.

It exists in Windows Vista, Windows 7 and Windows Server 2008.

The problem with it is it can get huge. Typically more than 5 GB but sometimes in excess of 15 GB. This can be a problem if your system drive is undersized with no way to expand it, or if you've paid for the expensive real estate of  a solid-state-disk, and don't want to waste all that space.

In summary, we will create an empty target winsxs folder in a different location from the system volume, then reboot into repair mode, copy the source contents to the new location, rename the source, and drop in a symbolic link to the new location. Upon restart, we can delete the original.

While in repair mode, drive letters can be different from when Windows is running normally. The saving grace is you can create a symbolic link to anywhere, even if the target doesn't exist. You just make your symbolic link target to the path of the relocated winsxs folder is while windows is running normally, regardless of what the drive letters are in repair mode.

In the below example, while booted into Windows, the Windows directory is C:\Windows, and the target winsxs folder is K:\Windows\Winsxs
While booted into Repair, the Windows directory is E:\Windows, and the target winsxs folder is D:\Windows\Winsxs
 

1. Create Target

With the machine running normally in Windows, create or identify target volume that will contain the winsxs folder
Create the empty path for \Windows\winsxs on that volume (K:\Windows\winsxs).
This path will be what you use in the repair console regardless of what drive letter is assigned while in the repair console.
Assign NTSERVICE\TrustedInstaller owner and full control of the folder.

2. Boot into Windows Repair

Restart the system and hit F8 before windows starts. Select 'Repair your computer'. If you don't see this option, you can boot off the Windows CD and there is a 'repair you computer'.
When the repair your computer GUI comes up, select command prompt.

3. Locate Volumes and Paths

Locate original system volume, it may not be C: when in repair boot (DISKPART helpful)
Locate target volume and path, it may be different when in repair boot

4. Copy winsxs content

Change directory to the Windows directory
xCopy contents of original winsxs folder to target winsxs folder
xcopy E:\Windows\winsxs D:\Windows\winsxs /e

5. Rename Source

Rename original winsxs folder
rename winsxs winsxs.old

6. Create Symbolic Link

Create a symbolic link in the original location that points to the new winsxs folder.
mklink /D winsxs K:\Windows\winsxs

7. Reboot

Reboot and start Windows normally

8. Confirm Success and Clean Up

Confirm C:\Windows\winsxs symbolic link exists and is targeted properly. It should function just like the folder is there in C:\Windows, however the content is on the other volume.
Delete original winsxs folder
rmdir E:\Windows\winsxs.old /s
3
31,741 Views
Adam LewisSr. Network Anaylist

Comments (2)

Adam LewisSr. Network Anaylist

Author

Commented:
As the author of the above article, I'd like to add the following update: Although the steps above are valid and do work in relocating the winSXS folder, I've found an unintended consequence: Windows OS updates no longer will apply after moving the WinSXS folder off the system volume. Other updates, for Office, .NET, SQL, etc do apply but the OS updates fail. Proceed with caution.
gr8gonzoConsultant
CERTIFIED EXPERT
Most Valuable Expert 2023
Distinguished Expert 2023

Commented:
I just came across this article by chance and although it's a little old, I'd strongly recommend you add a disclaimer to the top of the article in big letters to explain how hard-linking plays into all of this.

The WinSXS folder is usually a lot smaller than what it appears to be when you use any standard tool to calculate size (e.g. Windows Explorer, TreeSize, etc...). So even if those tools suggest that WinSXS is taking up 10 gigs, it might really only be taking up 1 gig or less. The reason for this is that many of the libraries are technically duplicates so Windows is actually creating tons of hard links to the original files.

If you copy the WinSXS folder to another drive/volume, you're likely to end up with physical copies of each file instead of copying the links, so you'll end up with 10 gigs of data instead of 1 gig of data with a bunch of links. And as you said in your comment, this can disrupt Windows Updates.

All that said, it's definitely worth updating the article to try as hard as possible to discourage anyone from doing this (big bold banner at the top), since it's usually doesn't have the desired effect AND it disrupts that update process, leaving the user more vulnerable to security problems that come up, like the recent spread of ransomware. Comments at the bottom often times don't get read.

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.