Skip to main content

Why Windows Installer May Require so much Disk Space

Windows Installer is an engine for performing transactional installations. When installing a product for the fist time, most often few or no files to be installed are already present on the machine. But when upgrading or patching a product, most often those files are replaced so copies must be kept if an error occurs and the installation needs to roll back. The following describes where and why Windows Installer may require so much disk space.

Extracted files

A bootstrap application may be required for a number of reasons. A bootstrap application may compressed setup files into the bootstrap application, or they might all be included in a self-extracting archive. Bootstrap applications may also download files from a web site either directly to a location on disk or indirectly to the Internet files cache.
This location is typically under %TEMP%.
If the extractor did not delete these files, you can delete these files after installation has completed. Note that some installers may register these files as a source cache. If the source cache is deleted and source is required for any reason, Windows Installer may prompt for the installation source or simply fail to reinstall the product.

Temporary local copy

If a full user interface is authored in a package and is to be displayed, Windows Installer creates copies of the .msi or .mspfiles in the user's %TEMP% directory. If this portion of installation - the client installation - was elevated, the %TEMP%location is for the user who authenticated and authorized the installation. Windows Installer uses this copy for initial disk space costs and through the UI phase until the installation script is to be generated.
This copy is in addition to any temporary copy that might have been extracted to the local hard drive. That is, the package that is referenced using msiexec.exe or in a Windows Installer API call is copied to %TEMP% with a Windows Installer-generated file name even if the source copy already was in %TEMP%.
This location is under %TEMP%.
If Windows Installer did not delete these files, you can delete these files after installation has completed.

Package cache copy

Whether or not a user interface is displayed, the primary portion of the installation - the only portion that should attempt to modify machine state - runs as a service. At this point, the package - either a .msi file stripped of any embedded cabinets, or an entire .msp file - is copied to the Windows Installer cache under %WINDIR%\Installer. If the installation is successful, this file will remain in that location for all future maintenance installations including uninstalling the product. Patch packages are cached in whole to make available any updated files for future maintenance installations like repairs or installing additional patches.
This location is under %WINDIR%\Installer.
These files cannot be deleted or future maintenance installations on products - including even uninstalling a product - will fail.

Installation scripts

There are two primary phases for Windows Installer: generate an installation script, then execute the installation script. But because Windows Installer is a transactional installation engine, unless rollback is disabled using either theDISABLEROLLBACK property or DisableRollback system policy a second script for rolling back the installation is generated.
These scripts contain all the operations that Windows Installer will perform when the script is executed. The rollback script is essentially those operations in reverse order. These scripts can grow quite large and are typically dependent on the overall size of a product. As an optimization, Windows Installer will typically not repeat file system directory and registry keys but will instead call SetTargetFolder or RegOpenKey opeations respectively, which set the scope for subsequent file or registry value operations. Custom actions can schedule similar operations to reduce disk space as well.
These scripts are created in C:\Config.Msi where C: is the fixed drive with the greatest amount of space available and is not necessarily the system drive.
These scripts must not be deleted. Windows Installer will delete them when an installation completes, even if an installation spans multiple reboots.

Destination files, registry values, and other reserved space

When the installation script is executed, if any files are to be copied or registry values written these resources will require space on the hard drive. Windows Installer will calculate how much space is required when the CostFinalize action is executed.
These resources are located wherever authored or the end user selected as the target location.
These resources should not be deleted; they comprise the product that has been installed and will likely prevent the product from starting up or functioning correctly. If any resources are deleted, you can repair the product from Add or Remove Applications control panel applet.

Copies of files for rollback

Because Windows Installer is a transactional installation engine, when existing files will be overwritten Windows Installer creates backup copies of those files. These files are created in a temporary directory along with the installation scripts. They are not compressed and will require as much space as those files required before being updated. Rollback files are more commonly created when products are patched, but are not limited to patch installation. Any product can upgrade files for another product, and should do so as shared components.
These resources are copied to C:\Config.Msi where C: is the fixed drive with the greatest amount of space available and is not necessarily the system drive.
These files should not be deleted. Windows Installer will delete them when an installation completes, even if an installation spans multiple reboots.

Baseline cache for patching and patch removal

Windows Installer 3.0 added support to uninstall patches and to provide a more robust experience for applying binary deltas to existing files without accounting for every possible state an existing file could be in. That is, if a patch were to update foo.dll v1 to foo.dll v2 using a binary delta applied to foo.dll, the patch would have to account for foo.dll v3 or even having been updated by another product installation, or the installation would fail.
To make either of these features possible, Windows Installer copies files to be updated to the baseline cache under%WINDIR%\Installer\$PatchCache$ for each product. At most, there might be two copies of files created since Windows Installer retains a copy of the original (RTM) file and the latest minor upgrade (often distributed as "service packs") when either version of a file is initially replaced.
Since Windows Installer only copies a file to be updated to the baseline cache if the file will be overwritten, a baseline cache for a file might only exist for one product even if updated by a patch for multiple installed products. This can lead to source media requirements when some products are updatedWindows Installer 4.5 provides a feature to fix this by copying shared files to all products' baseline caches that installed those files - thus increasing disk space consumption. This improves servicing scenarios but at the cost of additional disk space.
These files are located under %WINDIR%\Installer\$PatchCache$ in a per-product location.
These files can be deleted or the baseline cache disabled using the MaxPatchCacheSize policy but when uninstalling a patch or when restoring missing files you will be prompted for source if a user interface is displayed; otherwise, the installation attempt will simply fail.
Author: 

Comments

Popular posts from this blog

Remove previous versions using MSI Upgrade Table

There are several methods to uninstall the existing older versions of an application e.g. Script, MSI upgrade table, SCCM deployment conditions. We are here discussing the method using Upgrade table. Upgrade table can be used effectively to detect and uninstall the previous versions of a MSI based application provided the upgrade code is known. Here is an example on populating Upgrade Table: Locate the U pgradeCode in Property Manager . Remember this could either be same or different in previous version and if it is different then grab the code from previous version. Go to the Upgrade Table in Direct Editor . Copy the upgrade code to its column. Populate the Version columns based on requirement (consider all the digits as per previous MSI versions). Attribute column needs to be configured with appropriate bit flag for corresponding upgrade behavior. Refer to  Upgrade Table  to calculate the proper bit flag. In example, 768 is the sum of 256+512 which m...

Active Setup Registry Key : What it is and how to create in the package using Admin Studio Install Shield

While launching from Admin account or doing “Run as Admin” it was launching properly but when launched from the standard-user account, though it was launching but GUI was not coming properly and before launching, it throws the error that some particular Skin file is missing. I checked in installation folder and skin file was there but still while launching I was getting the error, but when launched from Admin account or using “Run as admin” it was launching properly with proper GUI and no skin file missing error. On exploring further I found that application was installed by admin account and it created some entries in HKCU, and these entries contain the path and name of skin file to be used. So when we launched the application from Standard user account then these entries were empty in HKCU for Standard user. So to solve this problem while re-packaging I used Active Setup . Active Setup provides a great solution for installing current user data when the package is not installed ...

Using the CorrectFilePaths Shim to Redirect Files on Windows Vista

The last time around , I suggested that you avoid using the acredir.dll shims - RedirectRegistry and RedirectFiles. As alternatives, I recommended VirtualRegistry and CorrectFilePaths. Of course, I have already gone into some details on how to use VirtualRegistry to achieve that, but I haven't gone in to any details on CorrectFilePaths yet. And, unfortunately, the documentation isn't much help as of the 5.0.1 release (as I said - stay tuned to the documentation for future releases, as this is something we are working on). In fact, here is all that the documentation tells you: "Corrects file paths that changed between Windows 95 or Windows 98 and Windows XP Professional. This compatibility fix works by converting the file paths to the correct location for Windows XP Professional in the APIs. For example, a Windows 95 path of C:\Windows\Write.exe is converted to C:\Windows\System32\Write.exe." While this is true, it is not comprehensive (and is, theref...