Posts RSS Comments RSS 288 Posts and 68 Comments till now

How to move the WinSxS directory in Vista

Update 11/20/2008: WinSxS, Disk Space and Windows 7.  I encourage everyone to read this post first before you consider moving your WinSxS directory.  You may just change your mind.

What is the WinSXS directory?

I stumbled upon a post in a forum the other day and as I began to read I suddenly realized that the author has solved a long standing issue I had with Vista, the HUGE WinSxS directory.  According to Microsoft literature this directory can not be moved or deleted.  Sounds like a challenge to me.

The following process outlines how to move this directory to another location.  This process is not for the faint of heart but if followed carefully will get the job done.  A certain degree of computer knowledge is assumed.  I’ve include a link to the original post to give credit where credit is due…and cleaned up the language a bit to make it easier to read.

Thanks Paul for your hard work…

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.  This is an unsupported mod.  Microsoft will not support you (and I cannot) should you choose to move the WinSxS directory.

Prerequisites:
  1. 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!
  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!

Print This Post

1 Star2 Stars3 Stars4 Stars5 Stars (6 votes, average: 4.50 out of 5)
Loading ... Loading ...
41,061 views

19 Responses to “How to move the WinSxS directory in Vista”

  1. on 05 Dec 2007 at 10:08 pmAaron Tiensivu's Blog

    Moving the WinSXS directory and the SoftwareDistribution (used by Windows Update) folder out of the Windows directory

    A nice step by step write up, based off Paul’s excellent post here, by the infamous Matt Wade can be found on his site here.

    Not only does he describe how to move the WinSXS directory, but also the SoftwareDistribution directory, which is used by …

  2. [...] detailed the steps on how to move the WinSxS and SoftwareDistribution (Windows Updates) directory here; thanks to a forum post created by Paul [...]

  3. on 19 Mar 2008 at 2:16 pmAnnihilatorX

    You ought to be careful with that though. Some updates, notably Vista SP1, would fail with an error numbered 80070011 if you junction the winsxs or program files folder.

  4. on 24 Oct 2008 at 11:26 amThomas

    This worked like a charm on my vista with SP1! I would like to mention that I had to give ownership to an account called “Administrator” for the movefile to work.

  5. on 25 Oct 2008 at 10:01 amAdamess

    Is that really working? I want to move this folder, but i don’t want to kill my system :)

  6. on 04 Nov 2008 at 7:37 pmSlycer

    Oh, GOD! Thanks Thomas! I spent an hour wondeing what went wrong. It’s a good guide but you really should make a note that the account that needs to take ownership is Administrator not your own account. Even if it’s in the Administrators group, apparently. Anywho, thanks Thomas.

  7. on 05 Nov 2008 at 12:53 pmMatt

    Thanks Thomas, I’ve udpated the post to include this new information.

  8. on 14 Nov 2008 at 12:35 pmMike

    Hi, every step in this guide works, but after last reboot i can´t delete winsxs.moved
    Now I have one copy on drive C and one on drive D. Can you help me pls?

    I can rename It, move It everywhere on drive C (not to D) but that´s all.

    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)
    Reboot

    this is last what work

  9. on 28 Dec 2008 at 1:52 pmAkul

    please help when i try to reboot the blue screen apears

  10. on 30 Dec 2008 at 11:45 amMatt Martin

    Hi. I did all the steps and everything looked good … but once I did the first reboot, my system was done it will not boot up … keeps restarting on its own … I wouldn’t recommend this for anyone that’s not willing to risk losing their system .. luckily I don’t really care lol I just reinstall vista

  11. on 02 Jan 2009 at 3:56 pmRoald

    Answer to Mike:
    I had the same problem after reboot. Setting “Full Control” access to “Administrators” for the winsxs.moved directory and all descendents did the trick. Actually, I gave that access right to absolutely all users on the system, just to be on the safe side. After all, I deleted it immediately afterwards anyhow.

    Thanks Matt!!!

  12. on 05 Jan 2009 at 10:00 amMatt

    Unfortunately, their isn’t much you can do here. Restoring the system from a backup or rebuilding is about all you can do. I wish I could offer more here.

  13. on 22 Jan 2009 at 4:31 pmcougar694u

    For anyone who bsod’s their box because of this, I found a way to bring it back.

    I killed a Win2k8 server by fat-fingering the mklink and not noticing it before a reboot.

    This is what I did to repair:

    1) Boot from the install CD (WinServer2k8 in my case, could also use Vista disk, I imagine)

    2) After selecting language, the next screen has an install button, but at the bottom is a link to repair the system. It should detect your installation, select it and click next (or load RAID/Disk controller if needed).

    3) Select command prompt from the next window. When the command prompted opened, I did a “dir c:\windows\winsxs*” and saw both folders, with the winsxs pointed to “C:\window\winsxs.moved” (notice the missing s??). I did a “dir c:\windows\winsxs.moved” to verify all my files were there, then ran “rmdir /s/q c:\windows\winsxs” to get rid of it.

    4) I copied the contents of winsxs.moved to d:\windows\winsxs with the following command:

    xcopy c:\windows\winsxs.moved\* d:\windows\winsxs /h/i/c/k/e/y/x

    That copied all 32,312 files over I had in my dir.

    5) Ran “rmdir /s/q c:\windows\winsxs.moved” and “mklink /J c:\windows\winsxs d:\windows\winsxs”

    6) Ran “dir c:\windows\winsxs*” showed the junction of the winsxs directory pointing to d:\windows\winsxs.

    7) typed exit, then clicked the reboot button on the window.

    After that, the system booted up fine, thank God!

    I checked the c & d drives and the space had changed accordingly (removed about 5g from the c and added about 5g to the d).

    I hope this helps someone else out there who kills their, box as I did.

  14. on 19 Feb 2009 at 2:52 pmcougar694u

    It should also be noted that this will break Windows Updates.

    Sure, it works as an interim fix if you have no other options, but it’s not for the long term.

  15. on 23 Apr 2009 at 3:42 amSimon

    Several people have commented that this will break windows updates.

    This should be obvious to anyone that has looked into winsxs, its structure and how files are added to it.

    winsxs contains HARD LINKED files that are placed there during updates or installs.

    Hard links can only work within a volume, they cannot work across volumes, which is what junctions allow you to do.

    You won’t see any errors until a later program tries to create a hard link in c:windowswinsxs from outside of it and will fail with a probably obscure message.

    A work around would be to restore winsxs to its original location, run the update then move it back to the other volume with the above procedure, but I think that would defeat the point of attempting the above.

    There are tools around that will shrink the size of winsxs by removing all old revisions of files and replacing them with hard links to the latest version of each file but this does require that the software using that works with the latest version – it may do, but you are risking all the dll hell problems that winsxs was designed (albeit badly) to cure

  16. on 27 Jun 2009 at 8:20 pmjorgewolf

    its immposible in win7.
    i have tried 3 times….
    asus EEE 901 4gb/8gb.
    win7 lite of 3.5 gb after install…

    i follow all the steps carefully….

    allways the same error…

    i reboot and get stucked after 10 secs of restarting… black screen…. no harddrive led….
    i thout could be the files moving or linking….and let it work more than 4 or 5 hours….
    nothing….
    black screen….

    3 times… same result….hours and hours….

    i just want win7 on my 4gb asus eee whit a minimum of 700 mg free to work.

  17. [...] http://aspoc.net/archives/2007/12/05/how-to-move-the-winsxs-directory-in-vista/ [...]

  18. on 08 Feb 2010 at 8:10 pmufischer

    I went through the above process to move winsxs to a mechanical drive from my SSD drive on a Win7 professional system and had a long process to finally get rid of the residual .dll files from winsxs.moved on the C: (SSD) drive. It kept denying me access. I tried closing all processes and services I could. I even shut down windows explorer, but still couldn’t get rid of the remaining 107MB worth of DLL files from the hundred or so very long named folders in that winsxs.moved folder.

    In the end, I choose to boot in system repair mode and went to command prompt. I eventually found my C: drive (it was E: drive in the repair mode command prompt box) and was then able to use DOS commands to remove the remaining .dll files and the huge stack of subfolders. Once I did that, I was then able to finally get rid of winsxs folder from the windows folder using a single rm winsxs.moved command.

    Anyway, If I ever have to do this again, I’ll go to repair mode command prompt right away and save myself a couple of hours of messing around.

    Thanks Matt. It would probably have taken another day or so of messing around without these instructions.

  19. on 24 Feb 2010 at 6:02 pmufischer

    Win 7 Updates kept failing after I moved winsxs as the above procedure. I tried putting in a /D link to SoftwareDistribution on in the same E: drive folder but still no updates.

    I tried making a link to e:C-movedFrom\Windows\SoftwareDistribution from c:\windows\SoftwareDistribution a /J link instead of a /D link but Win7 still doesn’t accept updates.

    Does anyone have a way to get updates happening without keeping all this stuff on the C: drive? I don’t mind if automatic updates don’t happen as long as I can go through the normal manual Win7 updates processing.

Trackback this post | Feed on Comments to this post

Leave a Reply

You must be logged in to post a comment.