Making your windows installation smaller: Difference between revisions

From Helpful
Jump to navigation Jump to search
Line 1: Line 1:
{{Mucking about with windows}}
#redirect [[Various_Windows_notes#Making_your_windows_installation_smaller]]
 
{{feelfree}}
 
 
First of all, '''drive space is ''almost'' completely unrelated to sluggishness.'''
 
Do it because you are, right now, starting to run out of space (or perhaps to avoid that on an SSD).
 
 
==Some of the easier, more effective things==
 
Most of these things clean up crud that builds up, so only need to be done once in a while, or just once.
 
 
===Window's Disk Cleanup utility===
 
In particular, use
* its '''More Options''' to remove all but the most recent restore point (if you want to)
* its '''Clean up system files''' to clean up after windows update, or after updating windows
 
===Utilities that clean up===
 
Such as [http://www.ccleaner.com/ CCleaner] and similar utilities
 
Removes
: only a few MB on a brand-new install
: more on something you've used for a while and never cleaned this way, and
: almost nothing if you do this regularly
 
===See where large documents are===
 
Particularly your own files that you just forgot were there.
 
See tools like:
* [http://windirstat.info/ WinDirStat]
* {{search|WizTree}}
* [http://w3.win.tue.nl/nl/onderzoek/onderzoek_informatica/visualization/sequoiaview/ Sequoiaview]
 
===Remove programs you never use (and can reinstall easily)===
 
Such as big games you haven't played in a while.
 
 
 
==Less effective, more manual, riskier hardcore nerdery, only in old versions, etc.==
 
Many other things have less effect, and/or require more hardcore (and potentially dangerous) nerdery.
 
 
===Removing all but the most recent Java update===
 
[http://www.java.com/en/download/faq/remove_olderversions.xml actually recommended on the java site itself]
 
 
 
 
===Removing windows components you don't need===
...though this hardly makes a dent. On XP you could strip ~200MB of things you probably never used
 
 
Note that the "Windows Features" thing in Win7 often just disables things and does not remove them{{verify}}
 
 
===WinSxS (Vista, 7, 8, 10)===
{{stub}}
 
'''tl;dr:''' Yes, it's large, and not ''all'' of it is useful, but '''there is little safe pruning'''
 
 
Some possible cleanup:
* If you have installed '''language packs you don't use''', you can use {{inlinecode|lpksetup.exe}} to remove them.
 
* Win7: If you have '''updated to SP1''', you can use {{inlinecode|dism}} to clean up a bit {{verify}}<!--
dism /online /cleanup-image /spsuperseded  - before the update those options are invalid? -->
 
* Vista: If you have '''SP1''', you can clean a bunch of files that are only necessary to uninstall this service pack. Look for <tt>vsp1cln.exe</tt> (part of the service pack).
 
'''Beyond that, don't mess with it.''' (you can skip reading the rest of this section)
 
 
Summary:
* "Side by side" (SxS) is how windows organizes its components and (DLLcache-like) backup filess, particularly the potentially shared stuff.
Primarily used in Vista, 7, and 8.
 
* The windows directory looks bigger than it is (varies, but easily by a few GB), because various parts it use [http://en.wikipedia.org/wiki/Hard_link hardlinks] {{comment|(multiple files on the filesystem that actually point to just one stored copy of the contents)}}.
** Most utilities {{comment|(''including'' Explorer itself, at least right now)}} do not understand hardlinks when counting size, so simply counts double/triple/etc. To get an idea of actual disk-space use, look for utilities like [http://www.google.com/search?q=hardlink+scanner Hardlink Scanner].
 
* WinSxS is functional. It helps avoid avoid DLL hell-like trouble. While it is sometimes overzealous in what it keeps, a lot of it isn't bloat. Unless you have a particularly small disk, the risks of pruning are probably not worth the small space gained.
 
* WinSxS contains
** windows's current system files (System32 and SysWOW64 have a ''bunch'' of hardlinks into WinSxS)
** other programs hardlink to libraries they install into SxS<!--{{comment|(For example, while there's ~3GB of files that are actually hardlinks within my Windows directory, and there is ~4GB of hardlinks if I count my entire system drive)}}-->
** a good chunk of the windows install DVD (so that you won't have to grab it later)
** what was previously the DLLcache is now Winsxs\Backup (sort of)
 
* You ''can'' remove things from this directory, in that you can manage to remove the protection. <!-- The directory is very seriously protected - you have to take ownership before you can even think about removing anything. (If you're going to do that, there's a convenient context-menu way that you can enable via a registry setting - you can google for it). -->
: ...you do so at the risk risk breaking some updates, installs, and programs.
 
* For most things in there, there is ''no'' automated cleanup, not even of components you don't use. You can try manual deletion, but it's risky unless you know for sure it's not.
: For example, you break search if you remove <tt>naturallanguage6</tt>
 
 
<!--
'''On hardlinks:'''
* Hardlinks mean there are multiple files on the filesystem that actually point to just one copy of the contents. Each hardlink takes negligible space - so you can get what looks like multiple copies, without using space
* Most space-summarizing utilities do not (yet) understand hardlinks, and overestimate the actual disk use, for your system disk easily by 2 or 3 gigabytes. Even Explorer doesn't count right.
 
 
* For example, Explorer reports my <tt>\Windows</tt> directory as 13.1GB, while it only uses 9.5GB of disk space.
 
* <tt>WinSxS</tt> itself it mostly real files, though. It's fairly normal for winsxs to be 6GB (rarely less than 3GB, though there are some stripped-down variants) on a fresh install, and it can grow to 8GB or perhaps 10GB by the time you're done installing everything. This varies with what flavour of windows you have, and whether it's a 64-bit or 32-bit variant.
-->
 
===%windir%\SoftwareDistribution===
{{stub}}
 
(Part of Windows Update?{{verify}})
 
tl;dr:
* <tt>\Downloads</tt> seems to be fairly safe to clear - assuming it's not in use right that moment.
* Don't touch the other parts.
 
 
===Installers, installer caches===
====%windir%\Installer (WinXP, Win7, more?)====
 
Usually meaning <tt>C:\Windows\Installer</tt>
 
 
Can easily contain a few hundred MB to 1GB or so of installers, all named something like <tt>46b0ca2.msi</tt>
 
Leave this alone, unless it's last-minute touch-up of kiosk images or so.
 
'''You ''can'' delete these files''', but doing so usually means the program it belongs to '''will not uninstall anymore, and possibly not update''', which may be more bother in the long run than a couple hundred MB is worth.
: You may wish to leave anything that may update/change regularly (iTunes, Silverlight, Office, etc. -  which are some of the largest) alone.
: The various smaller ones add up too. You could go through them if you have too much time.
 
 
To find out what each of these is
* right-click, properties, details will sometimes show a clear name.
* ...if not, you ''could'' run them, since almost all installers will gives a 'repair, uninstall, cancel' window before they do anything. Not everything, though...
 
 
Some of these files compress well, but most don't.
You may be able to shave off a few hundred MB, and it won't affect speed of anything but the fairly rare event of uninstalls and updates.
 
 
====Apple's <tt>Installer Cache</tt>====
(Somewhere in the <tt>All Users</tt> profile, though the exact path seems to vary a little)
 
Usually a few dozen MB (for iTunes, Quicktime) up to perhaps 600MB (many old versions of iTunes, Quicktime, Safari).
 
It seems that you can delete at leas the old versions you don't have installed anymore.
 
There seem to be other places Apple places installers for different software (the background services it adds, iPhone updates){{verify}}.
 
 
====Chrome versions/installers====
 
tl;dr: '''No need / no point.''' But you can.
 
 
Somewhere under a user's App Data, there's a <tt>Chrome\Application</tt> directory
which contains chrome.exe, and two \''version'' directories, each of which include an \Installer directory.
 
Chrome stores the current version and ''one'' old one, presumably to transparently fall back in case of problems.
It automatically cleans up older versions.
So while there's (order-of-magnitude) 200MB that isn't being used, it's a feature, it won't grow, and you'll get a new version on every minor chrome update.
 
====MSOCache====
{{stub}}
 
MSOCache is a local copy of MicroSoft Office installation files,
which Office's setup copies to in the root of one of your partitions when, at install time, it decides there's enough space for it.
 
It often takes up on the order of 250MB, sometimes more.
 
It helps Office do repairs, install patches/updates, and component (re)installs without needing the CD.
 
The MSOCache is one Local Installation Source (LIS) set (of which there may be more than one{{verify}}).
 
 
: '''Not creating'''
You can ask installers for some (but not all - which?{{verify}}) Office versions that you don't want this cache.
 
 
: '''Removing'''
You can remove the directory. If you do, know where your office CD is.
 
If you delete, Microsoft suggests you don't do it manually using Explorer, but with the standard windows Disk Cleanup utility {{comment|(do Disk Cleaning for the drive the MSOcache is on and manually check the option 'Office setup files')}}.
 
 
 
: '''Moving'''
 
If you e.g. have a cramped system drive and a separate large storage drive,
then it can make sense to ''move'' the LIS caches.
 
You can do this cleanly using the LIS tool:
* http://www.microsoft.com/downloads/details.aspx?FamilyID=10fa7aa3-695b-42c3-9045-b812ba0fed3e
 
 
 
: '''See also'''
Microsoft pages:
* [http://support.microsoft.com/kb/825933 'Local Install Source (Msocache)']
* [http://support.microsoft.com/kb/830168 'Frequently asked questions about the Local Install Source feature in Office 2003']
* [http://office.microsoft.com/en-us/orkXP/HA011362521033.aspx 'Repairing Office Installations']
 
Other pages:
* http://www.winhelponline.com/articles/167/1/How-to-recreate-the-Office-2003-Setup-files-folder-MSOCache-after-deleting-it-accidentally-using-Disk-Cleanup-utility.html
* ...more
 
===Removing windows update files (XP)===
...those that are useful only for reverts.
 
(mostly for XP, not so much under Vista and Win7 and later)
 
CCleaner can do this, as can various other things. If you know what you're doing you can do it manually.
 
 
===The windows DLLCache (XP)===
 
'''tl;dr: Safe to remove, but doesn't remove much''' and it saves you grabbing your install CD. Probably best to leave alone.
 
(...unless you're making netboot images for kiosk installs or such)
 
 
'''Purpose'''
 
The DLL cache is part of Windows File Protection (WFP) used in Windows NT, 2K, 2K3, XP, and somewhat differently in Vista and Windows 7{{verify}}.
 
 
WFP keeps an eye on system files (DLLs and more) and will notice (based on signatures) when such files are replaced, and transparently and quietly puts back the most proper version (that is knows of and has). This protects you from e.g. old installer programs that blindly overwrite system files with old/bad versions because they were meant for older or other versions of windows. {{comment|(over time it's become infeasible to even expect these installers to check)}}
 
 
The major source of these good versions is the DLL cache.
This is why you generally want to keep it, unless you ''really'' really need the 200MB to 500MB that the cache typically takes.
 
 
Notes:
: WFP is a convenience feature, not a security feature. Once a program is allowed to write to the windows directory, it can usually also write to the DLL cache and everything else in your system, so if a program is malevolent (malware, virsuses) it can usually circumvent this well enough.
 
: WFP looks for files in the DLL cache, the driver cache, the installation medium {{comment|(which may be a copy of the install CD on a local directory, or network directory)}}, and failing all of those will fall back to asking you for your install CD.
:: It probably also looks in the directories for hotfixes, since those register new DLL versions with WFP too.
 
: <tt>SFC.exe</tt>  (System File Checker) refers to a run-once command that does the same thing, which you can e.g. set to run at bootup. {{comment|(It was apparently introduced in Win98, which didn't have the WFP as a service yet.)}}
<!--
: By default, the dll cache is at <tt>%SystemRoot%\System32\dllcache</tt> {{comment|(where <tt>SystemRoot</tt> is usually <tt>C:\windows</tt>, or <tt>C:\WINNT</tt> for windows NT and 2000)}}. It can be moved, as long as you tell windows about it by setting the string value at <tt>HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SFCDllCacheDir</tt>, or through the policy editor.
 
: Important files from the windows install CD are automatically protected. It looks like you cannot (easily? at all?) register your own DLLs to be protected,  though windows update does this.
-->
 
 
 
'''DLLcache size, settings, and emptying'''
 
Unless and until a size limit is explicitly set, the dllcache will easily grow to a few hundred MB, depending on the variety of installs you do, hardware you plug in, and such. It shouldn't grow much beyond 500MB as there are only so many files to protect.
 
Different versions of windows also have (varying) implicit limits - none should completely fill op your drive.
 
 
You can also change most settings in the [[policy editing|policy editor]] in <tt>Computer Configuration/Administrative Templates/System/Windows File Protection</tt>.
 
 
A number of these can also be set with the <tt>sfc.exe</tt> utility, which primarily lets you:
* empty the cache: {{inlinecode|sfc /purgecache}}. Can be handy when you suspect something in it is corrupt. Alternatively, you can just delete the files in the dllcache directory.
 
* set a limit on its size: {{inlinecode|<nowiki>sfc /cachesize=100</nowiki>}} The number is interpreted as megabytes.
 
* trigger a check: {{inlinecode|sfc /scannow}}
(...and a few other things). See {{inlinecode|sfc.exe /?}} for more details. You'll need a [[windows command prompt]].
 
 
 
You ''can'' move the DLLcache - the directory it's in is looked up via a registry entry.
 
 
 
 
'''See also'''
* [http://support.microsoft.com/kb/222193 'Description of the Windows File Protection feature']
* [http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/core/fnhb_trb_msym.mspx?mfr=true 'System File Checker']
* http://www.updatexp.com/windows-file-protection.html
 
* [[Windows kiosk-style notes]], for notes on stripping down windows feature-wise.
 
<!--
To verify:
 
Note that while WPF doesn't allow upgrades by direct copy, if you copy the new file into the dllcache first it'll be fooled. This is a way to install for the dllcache-informed.
 
You can add files to the dllcache, but windows won't directly notice that until you reboot.
-->
 
===Driver cache (XP)===
tl;dr: '''You usually do not want to remove this.'''
 
 
The driver cache is a set of commonly useful drivers, such as low-level hardware that may change (ports enabled in the BIOS and such), support for basic USB device types, and more.
The driver cache means installation of these things can go fluidly, often transparently (without prompts to you), by having these files always be fetchable from this cache.
 
It's at <tt>%SystemRoot%\Driver Cache\i386\driver.cab</tt> (by default; it is pointed to by a registry key).
Windows service packs may store additional driver cabinets in the same directory, for example <tt>sp2.cab</tt>.
 
 
You can delete the driver cache if you are ''really'' pressed for space - but doing so will disable installation of a lot of (lower-level) hardware to be transparent to the user.
 
Disabling such previously automatic hardware installation is potentially useful for some admins, because it will now ask to look in other places, and for admin credentials to install. In short, you can use it to prevent users from installing their own devices. This is usually not necessary, it may include USB sticks and make your users very unhappy, and in some cases you may just be creating a lot of extra work for yourself.
 
==Some notes==
===on Windows 10===
 
Windows 10 is cleverer about being compact than earlier versions, including compression, so there's less to be won in the details.
 
Of course, remove any programs/apps you don't use.
 
 
If you did an update, it kept the previous windows copy, probably taking on the order of 10GB.
You can use Disk Cleanup to remove that.
 
 
===on Shadow Copy (Vista, 7)===
{{stub}}
 
Says microsoft: ''"The Volume Shadow Copy Service provides the backup infrastructure for the Microsoft Windows XP and Microsoft Windows Server 2003 operating systems, as well as a mechanism for creating consistent point-in-time copies of data known as shadow copies."''
 
 
It has existed since the later days of XP, but in Vista and Win7 it has more integration, and more things use it.
 
It supports:
* System Restore,
* 'Previous Versions' tab for files & dirs
* Certain backup programs (and the filesystem-level implementation (NTFS-only?) avoids locking problems)
 
 
You can clear them, change the maximum size allocated to it (usually a percentage of your disk size)
 
If you have WinDirStat/WizTree/Sequoiaview or such, you'll see these inside System Volume Information (on NTFS filesystems, at least)
 
 
<!--
Inspecting?
 
 
vssadmin
http://indrajitc.wordpress.com/2008/03/25/reclaiming-disk-space-from-system-volume-information/
 
vssadmin list shadowstorage
vssadmin resize shadowstorage /on=C: /For=C: /Maxsize=1GB
 
vssadmin list shadows
 
vssadmin list providers
-->
See also:
* http://en.wikipedia.org/wiki/Shadow_Copy
 
<!--
==Windows update files==
{{stub}}
 
 
===XP===
Windows keeps uninstalls for updates, which are useful in the (fairly rare) case that there turns out to be a problem with a patch.
 
On a fully patched XP SP2, you can easily remove ~400MB of Windows Update related files, at only the cost of not being able to uninstall the patches later.
 
 
The things you can delete include many (but not all!) directories in your Windows directory that start with <tt>$</tt>: primarily <tt>$NtUninstall</tt>... and <tt>$MSI31</tt>...
 
If you installed a service pack as a patch (not all are; there are slipstreamed XP install CDs, with service packs integrated) there are also uninstall files for that update, in something like <tt>C:\Windows\$NTServicePackUninstall</tt>.
 
 
'''A word of warning:''' There are other files which, when removed, will effectively disable/break updating altogether, which you usually do ''not'' want, unless perhaps you are creating a non-networked and possibly embedded system, and will be reinstalled if it will used be used for another purpose.
 
For example, <tt>$hf_mig$</tt> ("hotfix migration and multibranch support system") is important to windows update processes - it seems to be there to keep copies of different versions of files from different versions of non-hotfix updates (General Distribution Releases: security update, critical update, update, update rollup, driver, or feature pack). This allows updates to use the latest(/latest approved?) version of a file when the update being installed has an older one. {{verify}} [http://support.microsoft.com/default.aspx?kbid=824994]
 
 
Driver caches such as that in <tt>C:\Windows\Driver&nbsp;Cache</tt> and <tt>C:\Windows\'''ServicePackFiles'''</tt> are used to make installation of the more usual type of hardware easier.
 
These aren't strictly necessary for an already running system, but there's no obvious other place these files could come from once you delete them. You should probably only delete it on things such as embedded computers that will never ever have to install any hardware (not even memory sticks).
 
When you're pressed for space, compressing them may help, but only a little.
 
 
===Vista, 7, ...===
 
%windir%\softwaredistribution is primarily windows update. (It also exists in WinXP since SP2)
 
It seems you can safely remove ''only'' its <tt>Download</tt> subdirectory (Technically, you should stop the update service while you do this).
 
 
You can actually remove everything, which is a way to reset to fix windows update being in a weird state - but only useful for that, since most things just get recreated.
 
 
-->
[[Category:Windows]]
[[Category:Things only geeks would really care about]]

Revision as of 12:22, 16 September 2016