Update, April 17 2011:
If you move your winsxs folder to another drive, important/critical Windows Updates will fail with error code 80070011. Windows Update won't work with junctioned files, it requires hardlinks to the actual location of the data. There was a workaround for this in Windows Vista, but stopped working as of SP1. You can still move the folder to save space, but won't be able to run any more updates!
Update, July 6 2011:
Here's a handy article that explains the winsxs folder in detail, for those of you who just want to understand “why?!”
If you're anything like me, you want to run the latest-greatest programs on the newest operating systems available — and the worst thing you can do is sit and stare at loading screens. Your time is too important!
One of the best ways get blazing-fast performance from your computer is to run your OS from an SSD hard drive. But, while they may be fast, let's face it — they're definitely not the biggest hard drives in the world. Because 500GB+ drives are so inexpensive nowadays, the latest-greatest programs and operating systems all seem to assume everybody has tons of extra space.
But what if you're installing them onto an SSD hard drive? Do you really have 10GB to waste on a collection of restore points, previous updates, and cache files for 7 languages you don't even speak?
While programs like CCleaner are very helpful, deleting cache and temporary files are only going to free up so much space. No, it's time for drastic measures!
Today, I freed up over 15 GB of space on my SSD hard drive — without losing a single file.
Here's how I did it!
The Investigation
This week, my Limited Edition copy of Crysis 2 arrived. It was a no-brainer which drive I wanted to install it on: my Corsair SSD. When I saw the system requirements, though — “at least 9 GB of free space” — I was a bit surprised to see I only had 3GB left!
“What the heck? Where did all my space go?!”
With the help of TreeSize Free, I was quickly able to identify where all my free space went (see the program in action here.)
The first culprit was a huge (52,000 files, 9 GB) folder named “winsxs” which sat in the Windows directory. Looking through it, I found a collection folders with scary names and locked permissions. The first thing I did was search for “delete winsxs” on Google — and found a ton of pages which almost unanimously told me to leave it alone.
“Come on, really?” I thought. “I've only been using Windows 7 for 3 months. What happens when the winsxs folder hits 20 GB? What do I do — uninstall the programs I need to run my business?”
The Solution
Eventually, I came upon a forum discussion which told me exactly how to remove it.
WARNING: Proceed at your own risk. Incorrectly performing the following procedure may cause irreversible damage to your OS. It is highly recommended to backup your system before proceeding.
Below is the procedure:
You will need two utilities: PendMoves and MoveFile. Place them in \Windows\System32 directory for easy access.
Procedure:
1. In Windows Explorer navigate to the \Windows\WinSXS directory. Right click the directory to bring up the quick menu and select Properties. Click the Security tab to view the security properties. You will need to assign the Administrator user account ownership of the directory and then grant the Administrators group Full Access.
2. Open an administrator command prompt, and create a dummy directory. Execute “mkdir c:\windows\winsxs.moved“
3. Next, create a junction (like a Symbolic link for Vista). Execute “mklink /J c:\windows\winsxs.link winsxs.moved“
4. Now delete the winsxs.moved directory. Execute “rmdir c:\windows\winsxs.moved“
5. Now we will use MoveFile to schedule renaming of the WinSXS directory at reboot. This is the magic that will give us control over the directory.
6. From the administrator command prompt, execute “movefile c:\windows\winsxs c:\windows\winsxs.moved“. As you can see, this is renaming the WinSxS directory before Vista can get a lock.
7. From the command prompt, run “movefile c:\windows\winsxs.link c:\windows\winsxs“. This puts a winsxs directory back (as far as Vista is concerned), so everything doesn’t collapse in a heap.
8. From the command prompt, run “pendmoves“. It will show the two pending moves you’ve entered above, with NO ERRORS. If it all looks good, REBOOT!
[Note from Jody: at this point, when I rebooted my machine, I was a bit discouraged by the resulting blue screen. After a bit of confusion, I entered a command prompt from Startup Repair and put everything back to the way it was before I started. I then repeated steps 1-8, being extra-careful this time. Success!]
9. On reboot the critical renames/moves will execute, and the WinSxS directory will be unlocked and able to be moved in the next steps.
10. Open an administrator command prompt, and execute “dir c:\windows\winsxs*“. If you performed the previous steps correctly, you’ll see a WinSxS.moved directory and the WinSxS junction. If it did not work, repeat the above steps. Our next step is to relocate the WinSXS directory and amend the junction.
11. Using Windows Explorer, COPY the entire WinSxS.moved directory to a \Windows directory on another partition or drive.
12. When the copy is finished, rename the new directory from WinSxS.moved to WinSxS.
13. Go to an administrator command prompt and execute “rmdir c:\windows\winsxs“.
14. Then, execute “mklink /J c:\windows\winsxs d:\windows\winsxs“.
15. To be sure everything is happy, in Windows Explorer browse to c:\windows\winsxs. You will see all of the files. (Even though they are actually on your other partition or drive)
16. Reboot
17. After reboot, you should be able to delete c:\windows\winsxs.moved and FINALLY liberate all that disk space. Whew! Now take a bow.
This process can also be applied to the Windows Updates directory. When you download Windows Updates etc., the files get placed into C:\Windows\SoftwareDistribution, and this will quickly become huge. It is easier though… stop the Automatic Update service, move directory, create junction, restart service, DONE!
The Permissions
As it turned out, step 17 was actually quite a bit more complicated than just clicking the folder and hitting “Delete.” Though I was able to copy the folder to a different drive without hassle, deleting them would be another exciting episode of setting file and folder permissions.
“Take Ownership” is a great way to set permissions for files, but the right-click option disappears once you have more than 15 files selected. There were over 10,000 folders in the winsxs folder — and there was no way in heck I was gonna do them 15 at a time!
I needed a recursive script that would go through every single folder and set permissions. I found it here! (Note: this script refers to a file which can be downloaded here.)
To get it to work, I typed the following from a command prompt:
After that, I was finally able to delete the folder.
Success! 9 GB freed — and no files were lost!
The Fun Continues!
“Well that was exciting! How much more space can I free up?”
TreeSize told me there was a ton of other stuff taking up space, such as AdobePatchFiles, SpeechAnalysisModels and a few LocalStore folders. Most of them would probably never get used — no sense keeping them all on my precious SSD drive! If I could move it all to one of my larger-capacity 7200 RPM drives, I wouldn't have to worry about space and the performance would be “good enough” considering how often the files would be accessed.
Typing folders into a command prompt didn't really do it for me, though — not to mention mklink doesn't seem to work if there's a space in the folder name, such as “Program Files (x86)”.
My salvation came from the wonderful Junction Link Magic!
A mere 10 minutes later, I had freed up an additional 6.5 GB of space.
Long live the Symbolic Link!
Larkin
Hi there, I read all the article. Thank you very much for posting this. I was wondering if there is a way to undo a symbolic link, i did not see anyone mentioning that. I used the “takecontrolof” mentioned but it is not working. I mean first off i gotta say that i did not go through with all the process of moving winsxs because i chickened out Lol I cannot not back my system atm, and i only have this crappy HP stream, i have no space, i cannot update or even create a restore point (to rely on in case of a blue screen), that scared me a little, and i get crashes all the time, and to be honest window 10 is not like win7 no idea how access the safe mode, F5 not working anymore! So what i do? Thanks a lot
I saw the comments are quite old, but i hope i can still get some answers/help 🙂
Regards
Jody Hatton
The short answer is … don’t move your winsxs folder!
Windows Update won’t work any more. 🙁
Important/critical updates will fail with error code 80070011.
Dr Will
XDude, you’re the man. Thank you so much. What really REALLY annoys me is that Microsoft can do this thing. I live in China and last year bought a brilliant Hasee laptop with Ultrabook technology/SSD and Win7. Now a few months later I’ve got a fat red line on the C drive at “computer” telling me the drive is almost full. What happens when it is full? (Theoretically I could have my whole SSD full of WinSxS in about 3 years. DUH!) I’ve skyped a link to your site to my friend the IT man at the university where I work. He’s been trying to find a workaround for this crap with Win 7 too. I wish someone would come up with a viable alternative for MS – kick their backsides! Anyhow, thanks again friend. Well done!
Dr Will in China
Robert
Bought expensive ultrabook with ssd and Win 8. Tested to move winsxs to another drive. All well done, system restarts and stops with fatal error.
Why to hell… ???
Aha. It was external drive for the junction destination – also therefore ? Are files from winsxs used before the system starts and knows what drive is it that is used for junction points ?
So or so, with a super ultrabooks it is the best way to spend some bucks more and buy bigger ssd. Because We don’t want to carry (even if small) external hdd. And when forgotten to connect – the system breaks down immediately…
Or not ?
Steven
I can’t do the step 1! It says access denied when I try to do that! But I’m the administrator! Wtf?
Steven
(Fixed) Nevermind this
bill shockley
I can’t give a definitive answer either way. All I can say is I haven’t been able to do it.
There’s instructions on the web for moving the softwaredistribution folder. Basically, stop the update service, move the folder, delete the old one, create a junction, start the service.
But there’s also an important behavior of the service when the softwaredistribution folder is in its native location: If you delete the folder, the service will create a new one in its place. i.e., stop the service, delete the c:windowssoftwaredistribution folder, start the service, and you will see a new one created where the old one was. It will be populated with a few subfolders and files.
But with the transplanted folder, the service will not recreate the folder when you delete it. It will repopulate the shell of the folder with subfolders and files, if you supply the shell (i.e., create an empty softwaredistribution folder where the old one was), but it will not give you a whole new folder from scratch.
I consider this change in behavior parallel with the update service refusing to work for Windows 7 once winsxs and softwaredistribution are moved.
It’s rude and unwarranted.
Another curious thing is, earlier in the day today, I did the above experiments and then this evening I tried to duplicate them, with the result that I couldn’t even get the update service to populate the transplanted softwaredistribution folder with the subfolders and files. Not sure what I was doing wrong, but I think it was me, rather than the system.
I feel certain. If there was a way to hack around this problem, someone would have found it by now. There’s been adequate motivation and time. I declare my curiosity quenched! (Well, I’m still a little curious. I’m certain you can’t do it, but I’d like to hear the explanation from someone like Paul Obrien).
XDude
hehehe! Thanks for all the work you put into your investigations. 🙂
Jonny
You’re the first person I’ve heard mention “shared toolbars across builds” – something I’ve enjoyed (albeit with gremlins!) since windows began supporting native virtualisation…
I’m very impressed by your endeavours, and sorry to see the absence of junctioned softwaredistribution “respawn” was the show stopper…
Is this still desired? Is it worth (FURTHER) investigation?
“Where there’s a bill, there’s a wahey!”
Jonny
re junctions and softwaredistribution, it SEEMSit’s a hot topic –
http://bit.ly/1zeD7cd
http://www.freenixx.com/blogs/blog6.php/sysinternals-junction-command-1
http://superuser.com/questions/22235/can-i-set-up-windows-update-to-use-the-second-drive-for-future-updates
I wonder if the deciding factor is the copying of permissions.
haven’t looked up the params yet but this is cited frequently
xcopy C:WindowsSoftwareDistribution D:WindowsSoftwareDistribution /O /X /E /H /K
I’m gonna give it a go (winsxs and software distribution junctions) and report back…
bill shockley
Yup, it all works. Windows 7, winsxs moved, and successful Windows update. I’ve only done it once, so you might want to wait till I try it again to update your article. I’ll probably be doing it again some time this week.
As you say, it’s getting to be an irrelevant fix. The original fix was engineered back in 2008 when the sweet spot for price/size on a SSD was probably 32GB.
I only pursued this because I HAD TO!!
XDude
Well… and because you like hacking things. 🙂
bill shockley
I can see how the update thing would be a show-stopper for most people — i.e., people who have a life. For me, no biggie…
And furthermore, as SSD’s get bigger, this will probably be a forgotten problem. Certainly, MS was thinking this when they went to this design.
For me, I get started on something, and it’s difficult to stop. I’ll write back in a few if I get the whole thing automated.
Regards.
bill shockley
That is one piece of DEVIOUS hacking. I tried and tried and after about 24 hours and 6 drive images it actually finally WORKED. Took a lot of faith. And the takecontrolof thing was like the perfectly outrageous icing on the cake. Have it all working inside 2 batch files. If I can just get the delete operation to go smoothly without any manual help and without having to boot to the x-drive. Next step is to find out if it was all really worth the trouble!
XDude
Out of curiosity, which file(s) are you moving/deleting?
bill shockley
>>Out of curiosity, which file(s) are you moving/deleting?<<
I assume you're asking because you didn't have any trouble deleting winsxs.moved once you ran "takecontrolof"?
It may have been just me because I did some fiddling with that folder before I ran takecontrolof, so maybe it would have ran OK otherwise.
To answer your question directly: I moved winsxs to z:windowswinsxs and deleted the (temporary) winsxs.moved folder in c:windows.
I'll probably be doing this several more times. I use Acronis True Image (you can get a free version from Western Digital or Seagate) to restore the pre-moved partition image. For an 8-9 GB partition it only takes 2 minutes + 2 reboots. I do it from a second instance of Windows on another hard drive. So… don't worry about me!
XDude
Cool, thanks for all that!
Let me know if you’re able to run Windows Update. In my update at the top of this page, I basically recommend NOT moving winsxs… as much as it sucks… I ended up moving various unused programs and leaving winsxs alone.
bill shockley
Nope. Couldn’t update. I still think it’s worth doing if it frees a lot of space. Just image your drive before you do the move, and do the move right after you update. Then the next time you want to update,
restore the last image
update
move winsxs
re-image
If the move process is mostly automated it shouldn’t be too painful. Might even be fun. Maybe 30-60 minutes and a few mouse clicks.
This assumes you have all your data files on a separate drive. Desktop, email store folder, toolbar folders, etc. It takes a while to get set up that way — to learn all the ins and outs — but it’s cool once you’ve got it.
This page has a symlink method for moving your Users folder:
http://lifehacker.com/5467758/move-the-users-directory-in-windows-7 (a walk in the park if you’ve done winsxs).
I use that, plus I put my desktop on the root of my data partition, which is on the same physical disk as my C: drive. My toolbar folders are also there, along with my mail store folder. This way I can share them all with my other windows instance on my other physical disk. mail store folder is set in my mail program — windows live mail. Desktop is a registry entry. Toolbars, I’m sure you know, is just any old folder.
I’m also thinking about installing all of my applications on the data drive. I want to keep defragmentation time for the C: drive low. It’s 5 seconds right now, with a fresh install.
But I’m not sure how that’s going to work out (apps of F:). As with anything else I haven’t tried yet.
Jonny
Kudos! My bro’s ordered a solid-state, not sure if write-limits is still a factor, but if it makes more space for more (high-speed-access) resources on SSD, that’s motivation enough for me
Quick query: this ‘reconfig winsxs, optimising disk use, & undo to update windows’ proof of theory….
did you ever try it?
specifically –
restore the last image
update
move winsxs
re-image
…
Was it fun?!
Apologies if you’ve already answered this
Jonny
scratch that, just seen bill’s comments below – http://www.xdude.com/ssd-hard-drive-windows-7-winsxs/#comment-835
Will re-read and make notes and do some testing – feeling hopeful after (finally!) successfully completing ‘reduce unmounted vhd footprint’ operation using sdelete -z and diskpart compact (didn’t even need roxco perfectdisk apparently!)
bill shockley
Actually, now that I remember, desktop is moved most easily by right-clicking desktop | properties | location!
XDude
hehe! It’s nice to meet a fellow extreme-customization nerd. 🙂
I have 6 drives and 10 partitions. I only use my SSD for Windows and my Adobe apps, and my active video projects (it’s nice to be able to scrub and live-preview with full HD footage).
With that said, I leave winsxs alone now – not updating Windows (ever) is a bit risky!
bill shockley
UPDATE!
It’s simple to update windows after moving the winsxs folder. You just have to have the “softwaredistribution” folder in the symlinked windows folder, symlinked as with winsxs.
Turn off the Update Service. I did this by using msconfig. Click on the services tab, scroll to the bottom of the list and uncheck the Update Service.
Reboot.
Move the softwaredistribution folder from c:windows to d:windows
Open an elevated cmd window and type
mklink /j c:windows softwaredistribution d:windows softwaredistribution
Then go back to msconfig, turn the Update Service back on, reboot, and update!
I went to the original thread:
http://www.modaco.com/topic/261965-installing-vista-on-the-eee-701-ive-done-it-and-it-works/
and there didn’t seem to be a lot of belly-aching about not being able to update, so I took a couple hints and tried it!
XDude
So, to confirm, you have successfully moved the winsxs folder, AND still have the ability to do Windows Updates, and you are running Windows 7?
This is highly-excellent. I understand there was a way to accomplish this in Vista, but it no longer worked for Windows 7.
Personally, I’ve graduated to a 220 GB SSD, so moving the winsxs folder isn’t a huge priority for me at this point, otherwise I’d test your recommendation for myself. If your fix does work for Win7, though, I’ll add a note to the top of this article.
bill shockley
I tried it a couple times again last night and now it’s not working. The first time, when it
worked, I only downloaded a few updates, because I’m not really interested in updating…
I really can’t say for sure that it would have kept going. I think it’s possible because, for
example, I get varying results when I try to delete winsxs.moved from C:. I think it depends on
my windows installation. What updates I have installed. Whether I have uninstalled any. I see this
same finickiness I’m when trying to install Office 2010.
The whole process of making the junctions is so complex. And the way Windows is structured,
everything relies on everything else in a tangle of dependencies. After the novelty and
challenge of the hack wears off a little, you start thinking “keep it simple”. I’m heading
that way. Last night and today was a long series of unexpected Windows blow-ups. Everything
I did, even if it seemed so right, ended in failure. I’m back to a very simple install.
Enjoying using my computer.
XDude
Have I mentioned? This is currently the most-visited page on my website. There are thousands (if not millions) of people out there looking to free up precious space on their SSDs. There would be a great deal of value across the globe to know either:
“I moved my winsxs folder to another drive on a fresh install of Windows 7 and Windows Update DID work”
or
“I moved my winsxs folder to another drive on a fresh install of Windows 7 and Windows Update did NOT work!”
Are you the man who can give us that definitive answer? 😉
Pavel Vladov
Thanks for sharing. I am definitely going to try this soon. If someone is interested in more ways to free up space on an SSD, he may take a look at the following article, too:
How to Free Up Disk Space on an SSD in Windows 7
Jolas
Yes, it works, but now I have Problems with WindowsUpdates. I have an WindowsUpdate 80070011 error.
I leave the Programm Files Folder on SSD.
How can I fix it?
XDude
At the very top of this article, there’s a note which mentions that Windows Updates will no longer work if you move your winsxs folder to another drive. I’m afraid you’ll need to move it all back if you want to be able to update. 🙁
Edwin Vasquez
Is it as simple as just copy and paste the WinSxS folder back to its original location? Great article by the way but I would like to keep receiving updates from Windows Update, so yeah, kind of sad that I have to move it back
Doug
Worked great the first time through. However I could not delete all of winsxs.moved even after I ran “takecontrol c:windowswinsxs.moved*.*” I get a message that a file is in use even after shutdown and restart.
I’ve been looking for a year for something to fix my SSD drive problems with Windows 7 and this winsxs folder. Thanks for this post
Kevin
Has anyone figured out how to apply updates with this in place?
XDude
I haven’t … though I haven’t really tried, either. 🙂
I’ve decided it’s best to just leave the Windows folder alone, even though it recently broke the 25GB mark.
There’s still 6.4 GB free, though, so I’ve got some wiggle room!
Sharas
thanks for the post. I got rid of over 7GB
MT
Excellent post, well documented.
System files and folders have always been a dangerous thing to mess with and finally I’ll be able to reclaim some free OS drive space without breaking my PC.
I initially found this post as I was Googling methods of removing the SpeechAnalysisModels folder from Adobe’s “C:Program Files (x86)Common FilesAdobe” as the uninstaller does not give you fine-grain control of what to keep or scrap. Luckily I came across this gem of a post as now I can apply this to future folders that are unclear if really deleting them is a good idea just for the benefit of space. Win – win.
Thanks, I’m going to try it out when I have some spare time.
~MT
XDude
Thanks for taking the time to post your comment! It’s wonderful to know my long-winded posts are of benefit to people. 🙂
Oliver Lambert
Thanks so much for your article – really useful. I do have one suggestion though – I got the same blue screen event you had after the first reboot.
I think this is because one of your commands is wrong: step 3 should say “mklink /J c:windowswinsxs.link c:windowswinsxs.moved“ (i.e. you need to specify the full filepath for both files). Of course if you’re in the windows directory anyway this shouldn’t make a difference, but I think that’s why it broke for me the first time.
Worked for me anyway. Thanks again.
XDude
I’m actually considering removing the top section of my article. Junction Link Magic makes all the manual stuff kind of irrelevant, though I suppose it’s good to have respect for the “inner workings” before fooling around with system files.