Disable Windows 8.1 Component Store (WinSxS/DriverStore) automatic compression?

3

3

Windows 8.1 has a new Scheduled Task (Servicing\StartComponentCleanup) which will automatically delete or compress superseded and unused files from the Side by Side store, DriverStore and drivers folder.

I was wondering if anyone knows if it is possible to keep the component cleanup but skip the compression, all without disabling NTFS compression or the scheduled task?

Note that if some of the drivers/files start to be loaded/used Windows does not seem to uncompress them after they've been compressed. To uncompress them you have to manually run "compact /U" as the TrustedInstaller service.

Quad5Ny

Posted 2014-01-04T20:24:07.080

Reputation: 159

Using "fsutil behavior set" to enable the "DisableCompression" flag is not a option, it caused DISM to error out with 0x80070031 ERROR_COMPRESSION_DISABLED. – Quad5Ny – 2014-01-09T18:34:17.330

Answers

2

After some experimentation in a VM it appears that running DISM with the added switch "/ResetBase" will not compress any files whilst still cleaning up superseded components. There is a catch however, running ResetBase will remove the ability to uninstall updates.

Full solution:

  • Edit the Component Cleanup Task
    1. Open taskschd.msc and browse to \Microsoft\Windows\Servicing\
    2. Double click StartComponentCleanup
    3. Delete the Custom Handler in the Actions tab
    4. Add a new action with "C:\Windows\System32\Dism.exe" as the Program and "/Online /Cleanup-Image /StartComponentCleanup /ResetBase" as the Arguments


  • Decompress \Windows\WinSxS\, \Windows\System32\drivers\ and \Windows\System32\DriverStore\
    1. Open a Elevated (Administrator) Command Prompt
    2. Browse to the base folder you want decompressed (ex: Windows\WinSxS)
    3. Type "Compact /U /S /A /I /Q" and wait for it to finish
    4. Type "PSExec -hsi cmd"
    5. Browse to the base folder you want decompressed
    6. Type "Compact /U /S /A /I /Q" and wait for it to finish
    7. Type "Exit"
    8. Type "net start TrustedInstaller"
    9. Type "runassystem_x64.exe "runfromtoken_x64.exe trustedinstaller.exe 1 cmd""
    10. Browse to the base folder you want decompressed
    11. Type "Compact /U /S /A /I /Q" and wait for it to finish
    12. Type "Exit"
    13. Type "net stop TrustedInstaller"

Note: Your running compact 3 times because of different ACL's on files (Once as a Administrator, Once as Local System and once as the TrustedInstaller service.

Quad5Ny

Posted 2014-01-04T20:24:07.080

Reputation: 159

Side note: Running Windows Disk Cleanup utility with "Device driver packages" or "Windows Update Cleanup" checked will compress files regardless of the changes made in Task Scheduler (taskschd.msc). – Quad5Ny – 2014-01-10T03:13:14.737

4

How are you measuring the compression savings? Something is wrong in your numbers, because an RTM 8.1 image will save about 114 MB from the NTFS compression of in-box drivers alone (on x64). Just use explorer to get the size of c:\windows\system32\driverstore, and you will see there is about 114 MB difference between the "Size" and the "Size on disk". /startcomponentcleanup does not re-do work it has already done, so running it in the future will only have to compress new drivers, backup files, or superseded files.

With an RTM 8.1 image there is very little in the backups category that needs to be compressed, and there shouldn't be anything in the superseded category. The superseded category is the only compression that is skipped when /startcomponentcleanup /resetbase is used instead of normal /startcomponentcleanup. So, I'm not sure what advantage you are seeing by using it as far as compression performance. Compression of superseded bits (when you have them) does take some time, but it maintains your ability to uninstall a KB, while saving >90% of the space.

To see the accurate numbers for the effects of /startcomponentcleanup or /startcomponentcleanup /resetbase on winsxs, run dism /online /cleanup-image /analyzecomponentstore before and after running /startcomponentcleanup... Look specifically at the "Backups and disabled features" numbers. You will notice that there is a significant difference after running the command. Also, if you re-run /startcomponentcleanup, you should see that it completes fairly quickly the 2nd time, because there isn't anything for it to do.

Edit - Some actual numbers for comparison

For example on an X64 computer I just updated with January patch Tuesday updates (including optional updates), here's how compression breaks out, looking at just changes due to Jan. patch.

Note: The savings below come from compression that is not NTFS' compression and therefore the compressed files do not show as compressed in file explorer. NTFS compression is only used by /startcomponentcleanup for inbox driver compression (which is not included below and amounts to about 114 MB of savings for the driverstore)

Actual numbers using /startcomponentcleanup

+354.25 MB added for January updates
- 34.14 MB saved by superseded package removal
- 67.84 MB saved for Backups (99.86 MB compressed to 32.02 MB) 
-203.36 MB saved for Superseded Components (220.25 MB compressed to 16.89 MB) 
 ---------
  48.91 MB growth due to January updates after /startcomponentcleanup

Actual numbers using /startcomponentcleanup /resetbase

If you use "/startcomponentcleanup /resetbase" instead of just "/startcomponentcleanup", you save an additional 16.89 MB, but now you can't uninstall any remaining updates, and you may note that all of the same compressions are performed as above, except for "Superseded Components."

  48.91 MB growth due to January updates after /startcomponentcleanup
- 16.89 MB savings due to /resetbase
 ---------
 32.02 MB growth due to January updates after /resetbase

Example of using /analyzecomponentstore

Here's the results of running /analyzecomponentstore after applying January updates, and after running /startcomponentcleanup. Pay attention to the "Backups and Disabled Features" number, because that indicates the non-temporary storage needed for the component store (winsxs).

After applying January updates

Windows Explorer Reported Size of Component Store : 5.75 GB

Actual Size of Component Store : 5.51 GB

    Shared with Windows : 4.49 GB
    **Backups and Disabled Features : 884.98 MB**
    Cache and Temporary Data : 161.29 MB

Date of Last Cleanup : 2014-01-14 10:04:32

Number of Reclaimable Packages : 3
Component Store Cleanup Recommended : Yes

After running /startcomponentcleanup

Windows Explorer Reported Size of Component Store : 5.33 GB

Actual Size of Component Store : 5.21 GB

    Shared with Windows : 4.49 GB
    **Backups and Disabled Features : 595.02 MB**
    Cache and Temporary Data : 139.23 MB

Date of Last Cleanup : 2014-01-14 10:38:59

Number of Reclaimable Packages : 0
Component Store Cleanup Recommended : No

Troy

Posted 2014-01-04T20:24:07.080

Reputation: 73

the rules say that you must post this as comment and not as answer: https://superuser.com/help/answering

– magicandre1981 – 2014-01-12T18:51:12.253

You have to have 50 reputation to comment on either the question thread or the answer thread, which I do not have. – Troy – 2014-01-14T02:35:07.647

@Troy You seem to have created two accounts somehow. (1) http://superuser.com/users/288115/troy and (2) http://superuser.com/users/289377/troy

– Kevin Panko – 2014-01-14T20:55:18.340

You can have these accounts merged and then you will be able to make edits to your posts without waiting for approval: http://superuser.com/help/merging-accounts

– Kevin Panko – 2014-01-14T20:57:41.220

@Troy ok. btw I wrote you a PM on msfn.org – magicandre1981 – 2014-01-22T18:44:26.653

3

There is not an exposed mechanism for disabling the compression portion of the servicing maintenance task.

Which maintenance compression do want to disable, and why? The maintenance task compresses backups, and other duplicated files, and superseded updates. As you have noted, it also compresses inbox drivers using NTFS compression. Is it just the NTFS compression of inbox drivers that you would like to disable, and why?

Troy

Posted 2014-01-04T20:24:07.080

Reputation: 73

I was looking to disable the entire compression routine that the StartComponentCleanup switch runs. On a fresh install of 8.1 there's about 600 files compressed with the compression ratio averaging about 1.5 to 1... but the space saved is only 21MB. - I'm sure there has to be some advantages to the compression but I just don't see it. – Quad5Ny – 2014-01-09T18:30:22.790