• Shrink that gigantic WinSxS folder down to size

    Home » Forums » Newsletter and Homepage topics » Shrink that gigantic WinSxS folder down to size

    Author
    Topic
    #482539


    LANGALIST PLUS

    Shrink that gigantic WinSxS folder down to size

    By Fred Langa

    With its voracious appetite for disk space, WinSxS can be a problem for users of solid-state and other relatively small drives.
    Fortunately, Win7’s little-known Deployment Image Servicing and Management tool can help regain gigabytes of space.

    The full text of this column is posted at windowssecrets.com/langalist-plus/shrink-that-gigantic-winsxs-folder-down-to-size/ (paid content, opens in a new window/tab).

    Columnists typically cannot reply to comments here, but do incorporate the best tips into future columns.[/td]

    [/tr][/tbl]

    Viewing 19 reply threads
    Author
    Replies
    • #1327543

      Woohoo!

      “When Windows’ app installer misbehaves” fixed my problems installing the latest Java update!

      Thanks!

    • #1327549

      It’s a pity more research wasn’t done into the use of DISM, for those people running a 64-bit operating system get with
      C:WindowsSystem32DISM /online /Cleanup-Image /SpSuperseded
      the messages:
      Error: 11
      You cannot service a running 64-bit operating system with a 32-bit version of DISM.
      Please use the version of DISM that corresponds to your computer’s architecture.

      The trick is to use the 64-bit version of DISM, via
      C:WindowssysnativeDISM /online /Cleanup-Image /SpSuperseded

      My WinSXS folder went from 12,800 MB to 7.802 MB, in about 10 minutes.

      BATcher

      Plethora means a lot to me.

      • #1327578

        I have a win7 x64 and followed the instructions exactly as written in the column. Even cut and pasted the command line so no typos etc. Works just fine no error messages.
        Went from almost 15000 files to just under 11000 files and from 24+ Gb to 7.4 GB. BIG BIG difference. I did not time it, but it did run for quite awhile and I read email and online forums while it was running and did not notice any impact.

    • #1327725

      Eventually got this to work, cutting WinSxS folder from 11.4gb to 7.4gb. But Fred, your command line wasn’t clear that you had to leave a space before each back slash. I kept getting error message until I used dism.EXE and put in those spaces – btw, it wasn’t case sensitive. (My machine would not let me paste into the command window). Also it took more than ‘several minutes’ – more like 15.

      • #1327734

        But Fred, your command line wasn’t clear that you had to leave a space before each back slash.

        It’s a space before each forward slash, not back slash.

        (My machine would not let me paste into the command window).

        To paste into a command window, click the top left corner, then Edit, Paste (or just right-click).

        Bruce

        • #1327737

          > It’s a space before each forward slash, not back slash.

          > To paste into a command window, click the top left corner, then Edit, Paste (or just right-click).

          Thanks Bruce – I’m living and learning!

          Tim

    • #1327826

      Great post. My WinSxS went from 28.8 Gig to 7.1 Gig!

      • #1327831

        I tried Fred’s suggestion and it actually increased the size of my sxs folder from 12.3 Go to 12.4 Go!

        David

    • #1327882

      Many of the files in WinSxS have multiple links – eg this javascript file

      C:Windowswinsxsx86_microsoft-windows-g..zlegadget.resources_31bf3856ad364e35_6.1.7600.16385_en-us_a6285ac2a45ae884picturePuzzle.js

      is the same javascript file as this one

      C:Program Files (x86)Windows SidebarGadgetsPicturePuzzle.Gadgeten-USjspicturePuzzle.js

      It’s not a copy, or a mirrored replicant, it is the same bytes on the same sectors of the same disk 😉

      If you look at the Properties of a file that has multiple links you’ll see an additional sheet – Link Properties
      In there you’ll see a reference count – and under that there will list of the links. The count for the javascript file was 2

      Deleting the link from the winsxs subfolder will free up some space within the MFT (which is of a FIXED size anyway), but it wont free up the space used by the picturePuzzle javascript code, because it is still referenced in the Gadgets subfolder !!

      AFAIK Windows Explorer doesn’t have Reference Count as an available column. The x2plorer program does have it as a column, but it may only be available in the payware version. There are free gadgets that display an overlay icon on files with multiple links, Link Shell Extension is one, NTFS Link is another. Its worth having one of them for that feature alone. I use a red arrow like the one on shortcuts.

      The people who write programs like Windirstat ignore the fact that the same data can have multiple links (up to 1024). When asked why, they (or their fankids) usually blame Microsoft :rolleyes: If I can see the data on a properties sheet, then so could their programs :p

      I’m not saying that the cleanup wont save any space, it will, but not as much as you might think.

      I have a 40G disk, on it I have a single 5G file with a link in each of 12 directories.So the 40G disk appears to have 60G of data on it, but the disk reports 35G Free!! I use it to teach the basics of how file systems work.

      NW

    • #1327956

      I followed your instructions and my WinSxS decreased from 24.4 GB to 9.64 GB in size (a gain of 14.76 GB!).

      I rebooted and made sure that my recycle bin is empty.

      My question is why does my C drive not show any more available space after this process? It still shows 18.5 GB free of 59.6 GB on a 64 GB SSD on my Asus EP-121. (The free space doesn’t show as increased at all after running WinSxS and after shrinking the size of my WinSxS file from 24.4 GB to 9.64 GB). Obviously I missing a step or don’t understand something.

      Thanks for any help.

      • #1327990

        I followed your instructions and my WinSxS decreased from 24.4 GB to 9.64 GB in size (a gain of 14.76 GB!).

        I rebooted and made sure that my recycle bin is empty.

        My question is why does my C drive not show any more available space after this process? It still shows 18.5 GB free of 59.6 GB on a 64 GB SSD on my Asus EP-121. (The free space doesn’t show as increased at all after running WinSxS and after shrinking the size of my WinSxS file from 24.4 GB to 9.64 GB). Obviously I missing a step or don’t understand something.

        Thanks for any help.

        Oh dear, I hoped no one would notice – here we go – yet again ❗

        This is another one of those old chestnuts the squirrels forgot to bury 😆

        It’s because most of the ‘files’ you think are “stored in” winsxs are also “stored elsewhere”.

        In simple terms a file has two parts the data and an index entry in one or more directories (folder) – normally only one.
        However the NTFS file system allows the same data to appear in up to 1024 directories (folders).
        And I do mean the same data – not a copy, the same bits on the same sectors on the same track … on the same disk.
        These are known as hardlinks. They are part of the furniture on most file systems, and they’re NOT a Microsoft invention; I think they were ‘invented’ at Bell Labs NJ when Gates & Jobs were in grade school and Torvalds was in diapers ;), on reflection it may have been even earlier, on GE’s Multics and/or Burrough’s MCP in the mid 60’s.

        The winsxs folder is one of the few (only ?) instances where MS make use of hardlinks

        Open up one of the folders in winsxs, right click a file, select Properties, if there’s a Link Properties sheet open it (if there’s not, choose another file/folder, shouldn’t take long to find one) – you’ll see something like this (selected from my winsxs folder at random)

        Type of link : Hardlink
        Reference count : 2

        Hardlink enumeration – [something like]

        C:WindowsMicrosoft.NETFrameworkv2.0.507271033alinkui.dll
        C:Windowswinsxsx86_netfx-_vc_assembly_linker_messages_b03f5f7f11d50a3a_6.1.7600.16385_none_39b823fd61508f9falinkui.dll

        If you were to remove alinkui.dll from one of those locations you would regain not one iota of disk space
        Directory information is held in an area known as the Master File Table (MFT) which is pre-allocated and has a fixed size
        So removing a directory entry also regains not one iota of disk space.

        Only if you were to remove alinkui.dll from both locations would you regain some disk space, but then your computer may stop working – so don’t do it 😮

        AFAIK Windows Explorer does not offer Reference count in its list of Columns that can be displayed in Detail View, which is a pity.
        I use xPlorer2 as an alternative to Windows Explorer, it’s Pro version does offer Ref count in its list of Columns, not sure about its Free version.
        I also use LinkShellExtension, which I have configured to put a red arrow glyph on file icons that have multiple links.

        Utilities like Windirstat could use the information from the file properties to avoid counting stuff twice.
        I did ask Windirstat why they didn’t – they blamed Microsoft 🙁

        It’s disappointing that Fred Langa should write on this issue in the way that he has.

        I don’t believe Fred does not know that most the files in winsxs are illusory, and getting rid of them will not regain much disk space.
        I’m not saying that running DISM isn’t a useful thing to do, but as a disk space saving measure it can be very deceiving.
        Fred must know this and he should tell people about it – he writes after all in the ‘paid for’ section of the newsletter.

        If Fred doesn’t know about hardinks and how they can create illusions; or if Fred doesn’t know that many (most ?) of the files in winsxs are illusory, then maybe Fred’s not as smart as I thought he was.

        NW

    • #1328043

      Thanks for your detailed and thoughtful explanation. It surely does answer my question.

    • #1328113

      @northwood2222 – WinSxS has changed usage considerably since its initial incarnation. Originally it was used only as you describe. Now starting with Vista and continuing with Win7 it is where all the files to service Windows reside. Using DISM after installing a service pack will remove a good many unneeded files – i.e. all the updates superseded by the service pack.

      See What is the WinSxS directory?.

      Joe

      --Joe

      • #1328162

        @northwood2222 – WinSxS has changed usage considerably since its initial incarnation. Originally it was used only as you describe. Now starting with Vista and continuing with Win7 it is where all the files to service Windows reside. Using DISM after installing a service pack will remove a good many unneeded files – i.e. all the updates superseded by the service pack.

        See What is the WinSxS directory?.

        Joe

        Joe – Windows 7 Disk Clean offers a much easier (better ?) way to do the Service Pack clean up than running DISM
        See ==>> http://windowsteamblog.com/windows/b/bloggingwindows/archive/2011/02/16/windows-7-sp1-follow-up.aspx

        I run Disk Clean on my system drive once a week, so I would have checked the Service Pack Backup Files checkbox soon after the SP1 install.

        The Vista SP1 & SP2 packages came with specific cleanup utilities that MS recommended be run once the user was satisfied the SP had done no harm.

        It would be interesting to know if rwnoble & others who are “disappointed” in DISM’s impact, had previously checked the relevant box in Disk Clean or run the post SP install cleanups on Vista.

        I stand by my criticism of Fred on this issue. Sending people off to the command line when there’s a perfectly good tick-a-box solution at their fingertips (or purpose built program in the case of Vista) is less than I would expect of someone offering fee earning advice. Better advice would be

          [*]On Vista run the SP cleanup utilities, with the caveat “You won’t be able to uninstall the Service Pack”.
          [*]On Seven run Disk Clean, tick the Service Pack Backup Files box, with the caveat “You won’t be able to uninstall the Service Pack”.
          [*]Get rid of software you don’t use, especially free software – you can always get it again, or better yet archive the install package.

        Sometimes it seems that no matter what MS do make users lives easier, the Windows guru’s will soon find a way to make it hard again.

        NW

    • #1328161

      For first time users of DISM, in Step 5, it would be useful to say WHEN DISM is finished running so as not to presume that 100.0% is the end… It is when “The operation completed successfully” and the C:WindowsSystem32 reappears…. after some 20 minutes. Running Win7 ver 6.1.7601.17514 BEFORE running DISM, Properties of Winsxs showed 14.8GB, 16K folders and 78K files. After DISM finished, the FIRST look showed 7.15GB, 11K folders and 47K files… and after a few minutes of mail check and such, I ran it again… this time it showed 5.28GB, 9K folders and 38K files… so when a little later I ran Properties a 3rd time, I got 5.12GB, 9K folders and 37K files. MyComputer showed 134GB free space BEFORE running DISM and 136GB AFTER running DISM and restarting Win7…. a gain of 2GB after reducing a Folder from 14.8GB to 5.12GB… Northwood 2222 may have a point! Informative article as always, Fred.

    • #1328165

      Going a bit beyond the winSXS conversation

      The Windows 7 Disk Cleanup utility when run as a simple batch with the sageset/sagerun command, as mentioned by northwood2222:

      %SystemRoot%System32Cmd.exe /c Cleanmgr /sageset:65535 & Cleanmgr /sagerun:65535

      30564-Untitled
      Will provide the option(s) of doing a deeper clean than that which would normally be effected from the use of Disk Cleanup
      without the sageset/sagerun commands. This indirectly contributes to reducing the size of the SXS folder.
      There is the option to remove Service Pack installation setup files if one had installed them in the first place, thereby
      making any service pack permanent, and also indirectly reducing the SXS footprint.

      I’ve run the above previously on many occasions, so that the;
      C:WindowsSystem32DISM /online /Cleanup-Image /SpSuperseded”
      command seemed to have had little effect, if any at all.

      DISM as a whole on the otherhand, sounds a bit more complicated. If I’m not mistaken in my readings regarding this, might it open up
      a whole new way of tailor hacking Windows 7? Might it be possible to remove considerable bloat in terms of generic drivers support
      that the operating system installs for compatibility purposes, many of which, once a system is set up, could be nit-picking-ly
      removed if not needed. This is something that MS would never mention directly as it would obviously break the os and lead to
      numerous support calls.

      I still think that there is so much more that could be done to remove bloat overall in Windows 7 that DISM needs to be explored.
      I invite Fred Langa to delve further into Deployment Image Servicing and Management.

    • #1330037

      His link for copying into a command prompt in win 7 64bit does not work at all says it is not a valid command or something like that. This is what I copied and pasted from the article:

      C:WindowsSystem32DISM /online /Cleanup-Image /SpSuperseded

      unfortunately when I open a command prompt it already has C:usersXXXX> filled in and can not be deleted.

      So does not work for win7.

      • #1330041

        unfortunately when I open a command prompt it already has C:usersXXXX> filled in and can not be deleted.

        That would be the command prompt.

        Bruce

      • #1330105

        His link for copying into a command prompt in win 7 64bit does not work at all says it is not a valid command or something like that. This is what I copied and pasted from the article:

        C:WindowsSystem32DISM /online /Cleanup-Image /SpSuperseded

        unfortunately when I open a command prompt it already has C:usersXXXX> filled in and can not be deleted.

        So does not work for win7.

        DISM does work on Win 7, but the command as shown in the article is incorrect.

        However, on Win 7 you don’t need to use the DISMal command, use the Disk Cleanup Program as described in an earlier post

        Type Disk Cleanup in the Search Box
        Select Drive C (that should be the default)
        Tick the box that says Service Pack Backup Files
        Click OK

        job done

        NW

        • #1330127

          DISM does work on Win 7, but the command as shown in the article is incorrect.

          However, on Win 7 you don’t need to use the DISMal command, use the Disk Cleanup Program as described in an earlier post

          Type Disk Cleanup in the Search Box
          Select Drive C (that should be the default)
          Tick the box that says Service Pack Backup Files
          Click OK

          job done

          NW

          I wonder what the correct command prompt would be for win 7? As I am just curious as to what it does. If it only does what disk cleanup does then was a pointless article.

          • #1331323

            The SXS folder is not problem for me on WinXP SP3. It is only about 66MB. Hardly worth worrying about.

            The real problem for me is the INSTALLER folder under the Windows folder. That beast is 5GB (4GB compressed), which is about 1/3 of the used space on my C: partition! This is criminal!!

            30791-Windows-Installer-folder

            • #1331374

              The SXS folder is not problem for me on WinXP SP3. It is only about 66MB. Hardly worth worrying about.

              The real problem for me is the INSTALLER folder under the Windows folder. That beast is 5GB (4GB compressed), which is about 1/3 of the used space on my C: partition! This is criminal!!

              Did you see XP being specifically addressed in yesterday’s newsletter?

              Windows XP uses an early version of the WinSxS subsystem. Among other things, XP does not store backups and safety copies of DLLs associated with Windows Update files in the WinSxS folder. Instead, it stores them in the normal Windows folder. …

              More on shrinking Windows’ huge WinSxS folder

              Bruce

            • #1331384

              Did you see XP being specifically addressed in yesterday’s newsletter?

              Windows XP uses an early version of the WinSxS subsystem. Among other things, XP does not store backups and safety copies of DLLs associated with Windows Update files in the WinSxS folder. Instead, it stores them in the normal Windows folder. …

              More on shrinking Windows’ huge WinSxS folder

              Bruce

              Perhaps you could state whatever it is you are trying to communicate more directly? Because as written, I have absolutely no idea what you are trying to say!

            • #1331387

              Perhaps you could state whatever it is you are trying to communicate more directly? Because as written, I have absolutely no idea what you are trying to say!

              It was a very simple and straightforward question, with a quote and link to very recently updated information, which was intended to be helpful.

              If you’re not interested in answering or looking, just ignore it.

              There was no intended hidden comment.

              Bruce

            • #1331422

              It was a very simple and straightforward question, with a quote and link to very recently updated information, which was intended to be helpful.

              If you’re not interested in answering or looking, just ignore it.

              There was no intended hidden comment.

              Bruce

              If you had read my post, you would see that I stated that I was using Win/XP SP3. SO why are you asking your question and what does the answer do for you, one way or the other?

            • #1331446

              If you had read my post, you would see that I stated that I was using Win/XP SP3.

              I did and I did, which is exactly why I asked the question which for some totally obscure reason you don’t wish to answer.

              SO why are you asking your question

              It was a polite way of referring you to additional information which you might have seen but probably hadn’t judging by the context, thus the question rather than a statement.

              and what does the answer do for you, one way or the other?

              Absolutely nothing; which is why I said, “If you’re not interested in answering or looking, just ignore it.”

              Bruce

              P.S. Have you realized yet that I was trying to assist you? How can an informative link offend?

              P.P.S. Would it help if I went back to my innocent question and underlined the word yesterday?

    • #1330038

      See if reading my post #3 (above) helps!

      BATcher

      Plethora means a lot to me.

    • #1331458

      @Bruce – I suppose your posts are clear to you but they are obtuse to me.

      I’ve told you that I am on WinXP, that my SxS file is small and of no concern and that my concern is the INSTALLER file.

      Why can’t you just come out and say whatever it is that is on your mind instead of beating around the bush?

    • #1331460

      Alright kiddies, let’s keep things under control here.

      • #1331891

        I need to step in here with a bit of trepidation, to follow up on the question regarding the Installer folder…
        First, please understand that I have carefully re-read everything here and in the follow-on article.
        Let me be as clear as I can about my question.

        My Installer folder is 2.4 G.
        It contains .5 G of $PatchCache$, which I expect I can delete since it is contained between the $’s, right?
        The rest of the Installer folder is a collection of windows Installer package, patch, .rmi, script, icon, .exe, etc files dating back to 2005.

        Now, my question is – can I just delete the entire contents of my Installer folder if I am happy that my XP SP3 system configuration is stable?
        If not, perhaps just the cache?
        If something in between, how do I figure out what stays?

        Unless I missed it, my question wasn’t specifically addressed in any of the previous discussion.

        • #1331924

          I need to step in here with a bit of trepidation, to follow up on the question regarding the Installer folder…
          First, please understand that I have carefully re-read everything here and in the follow-on article.
          Let me be as clear as I can about my question.

          My Installer folder is 2.4 G.
          It contains .5 G of $PatchCache$, which I expect I can delete since it is contained between the $’s, right?
          The rest of the Installer folder is a collection of windows Installer package, patch, .rmi, script, icon, .exe, etc files dating back to 2005.

          Now, my question is – can I just delete the entire contents of my Installer folder if I am happy that my XP SP3 system configuration is stable?
          If not, perhaps just the cache?
          If something in between, how do I figure out what stays?

          Unless I missed it, my question wasn’t specifically addressed in any of the previous discussion.

          I thought the same thing and tried deleting the folder. It royally screwed up my Windows install and I had to do an image restore.

          Apparently, Microsoft doesn’t like this folder to be deleted (at least for me).

          But if you find a way to kill it, please do let us know.

    • #1332119

      I may try it a piece at a time.
      I’ll start with the cache…

      • #1373836

        Hopefully this thread can be resurrected for Windows 8…

        I have a clean install of Win8 Pro x46, and another that was installed over a clean install of Win 7 – so no service packs installed on either. These are virtual systems and are on an SSD, so space is at a premium. The ‘upgrade from Win 7’ install has a large WinSxS folder – about 9GB, on a clean install. Tracking down the 64 bit dism.exe took a few minutes, the folder at the top of this thread doesn’t exist and the version in syswow64 is 32 bit; the WinSxS folder itself has a subfolder, management_31bf3856ad364e35_6.2.9200.16384_none_b7734a7c9770a13d, with a dism.exe that seems to be the correct one; however it merely tells me that no service packs have been installed, and does nothing to shrink the WinSxS folder.

        So, can anyone advise on how to shrink WinSxS on a clean upgrade install of Win 8 Pro x64 from a clean install of Win 7 x64 (Home Edition)??

        Thanks.

      • #1373837

        I omitted to add that the clean install of Win 8, from the same iso image, doesn’t have this inflated WinSxS folder. Incidentally, should anyone wonder, I’m not trying to circumvent activation; I paid for the licence and installed the clean version, but it won’t activate, so I reinstalled as an upgrade. The upgrade install has activated but is rather large; there seems no good reason why it should be any larger than the clean install, since I cleaned up the windows.old and windows. bt that were also cluttering things up.

    • #1373840

      Clean Install with Windows 8 Upgrade

      This tutorial will show you how to do a clean install with a Windows 8 upgrade copy.

    • #1373841

      Thanks CLiNT; now I’m unsure what MS will make of a 2nd attempt to activate using this serial, but I’ll give it a go.

      Meanwhile, I checked and found the clean install has a WinSxS file about 4GB smaller than the upgrade install. Since both are ‘virgin’ Win 8 systems, there just can’t be any good reason why the extra 4GB has to be there, and it would be great to know how to get rid of it.

    • #1373843

      Mine is between 9 and 10GB

      You cannot trim it down except through a clean install or some serious program uninstalling effort.
      I would not recommend removing anything from it either, at least not without making a drive image first.

      You will also note that many of the installation files within the ISO are compressed and will expand to form the
      basis of the file & folder sizes you see when clean install is completed. Hard links too may provide a false sense of size as well.

      Provided you have a legitimate license, you should be able to reinstall as many times as you please without issue.

    • #1373848

      As it happens, I realized that I hadn’t run Windows Update on the later install whereas I had on the earlier, so after 30 minutes of updates I checked and the clean install WinSxS was over 9GB, i.e. the difference in size was due to upgrades.

      There has to be some sort of check by MS on number of activations, otherwise a single serial could be used by 1000s of people. I prefer to limit things to what a real user would do, which is occasional reinstalls. MS can be flexible: I have an XP OEM license that I upgraded to Win 8, then installed it on a virtual system and it activated fine. Meanwhile I figured that $40 (via the MS promo) for a genuine virtual Win 8 system was good value, and I can move it over to a h/w system later if needed. Do people realize how good virtual machines have got of late? I used VMware Player – which is free – to install Win 8, and the result, on a Dell XPS 8500 with SSD and Radeon 7770, can play Oblivion with fairly high end settings. Until a few days ago I hadn’t even realized virtual machines could do 3D at all…

      Anyway, thanks for the advice.

    • #1427696

      I am running Windows 7 Pro SP1 64bit and needed to recover some space and came across this 1 1/2 year old article.

      I came here to post about a typo in the original 2012-04-05 article “Shrink that gigantic WinSxS folder down to size” but see several others have already pointed it out. I am surprised that the typo still exists in the original article. I am sure that most of your seasoned WindowsSecrets readers would have no problems navigating to these forums for help or they would probably have figured out the problem themselves, but I can imagine a new subscriber would not have found the solution so easily.

      I copied and pasted the commandline into the command prompt windows as suggested (with no problems pasting) and received the error:

      Error: 87 The online/cleanup-image/spsuperseded option is unknown. For more information, refer to the help by running DISM.exe /?

      After running the help on the command, I discovered that the actual command was

      C:WindowsSystem32DISM /online /Cleanup-Image /SpSuperseded

      (spaces required before each of the “/” forward slashes of the commands and arguments)
      (Not sure why running the commandline as is would run a 32bit command when the notebook came factory-fresh as a 64bit pc, as was mentioned above.)

      I gained almost 4 GB after running the command, which helps some. Still have some more things to do per Fred’s original article, so hope to gain another GB or 3.

    Viewing 19 reply threads
    Reply To: Shrink that gigantic WinSxS folder down to size

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: