How to delete unused folders and files located within the $hf_mig$ folder – Part 2
In part 2 of this article I’ll show you how identify and delete some but not all of the actual sub folders located in the C:\Windows\$hf_mig$ folder. Again as a reminder, you will not be deleting the $hf_mig$ folder, just “some” of the KBxxxxxx sub-folders contained in the $hf_mig$ folder.
As stated in part 1, the conventional answer to deleting the $hf_mig$ folder has always been not to delete it. While this still holds true for the folder, there are ways to identify and delete a large number of sub-folders and files contained within $hf_mig$. Part 1 also covered how to delete one very specific file (update.exe) which exists in each of these update sub folders.
If you look at the contents of the $hf_mig$ folder you will see possibly a hundred or more sub folders named KBxxxxxx. Each of these sub folders corresponds to a Windows Update that was installed on your computer. The sub folder creation date tells you when that update was installed on your computer and can over time, as each month’s set of security updates have been installed can end up consuming 1GB or more of disk space. Now I will show you how to identify and delete a large number of the KBxxxxxx sub folders and their entire contents.
Windows Update process: When Windows Update downloads an update to your computer the download file is first verified as a good download, then the actual installation process begins. The “update.exe” file that is part of the download runs and performs the actual installation of the update.
Part of update installation process is to scan and read the contents of a file named “update.ver”, of which there is one for every C:\Windows\$hf_mig\$KBxxxxxx folder. Technical description of installing Windows updates: http://support.microsoft.com/kb/824994
Once the security hotfix or update is installed, you will find a new C:\Windows\$hf_mig\$KBxxxxxx folder has been created.
Developing baseline configurations for this article: Windows XP Pro SP2 with all the applicable security updates released prior to May 2008 installed. This PC is now at the point were XP Service Pack 3 first became available.
If you were to check the Control Panel’s ‘Add/Remove programs’ list (with the ‘Show Updates’ box checked) you will see a long list of updates displayed. Typical names for updates would read as follows: “Security Update for Windows XP (KB123456)”.
After Installing XP Service Pack 3: After establishing the SP2 reference point I installed XP SP3, which will be one of the two baselines for all further test results. This configuration is referred to as Baseline #1 later in this article.
Once SP3 completed the install process and the PC rebooted I again checked the ‘Add/Remove’ list. All the SP2 updates are no longer listed (they are now considered part of SP3). The significance of this is three fold.
1) The once listed update(s) can no longer be uninstalled using the Control Panel’s Add/Remove feature and for good reason as you would end up uninstalling a part of the SP3 update.
2) The actual uninstall folders however are still located on your hard drive (C:\WINDOWS\$NtUninstallKB123456$) I have already covered how to delete these folders in an earlier article.
3) Installing SP3 also did not delete any of the corresponding C:\WINDOWS\$hf_mig$\KB123456 and all the other KBxxxxxx sub folders. They are also still on your computer’s hard drive taking up disk space. Here we are going to focus on identifying specific $hf_mig$ sub folders that are candidates for deletion. Keep in mind that I am referring specifically to the updates listed in this document: “List of fixes that are included in Windows XP Service Pack 3”: http://support.microsoft.com/kb/946480/
In short, installing SP3 did not remove any of the old SP2 KBxxxxxx sub folders!
Warning: You may also have other updates installed that are not specifically related to XP SP3. For example: .NET Framework (versions 1.x, 2.x, 3.x or 3.5), Windows Genuine Advantage and possibly others. These updates which are still part of the Add/Remove list are not to be touched or deleted.
Comparing each of the two computer baselines: Baseline #1 as mentioned above represents a “Clean Install” of Windows XP Pro SP2 followed by activating Windows, and then immediately installing all security updates available for SP2 that were released prior to May 2008 (which is when Service Pack 3 was released). Service Pack 3 was then installed. No additional updates where installed after upgrading to SP3.
Baseline #2 was created buy using baseline #1 as a starting point and then selectively deleting only the C:\Windows\$hf_mig$ sub folders that are listed in the “List of fixes that are included in Windows XP Service Pack 3”.
Tests guidelines: Both baselines will be tested by using Windows Update to install all available updates from May of 2008 (post SP3 release date) up to and including May of 2009. The objective is to see if the installed updates are identical when using each baseline as a starting point.
Spock’s Logic: Since a computer with a clean install of Windows XP Service Pack 3 logically does not include any Service Pack 2 updates the results of applying future updates should be the same as those for a computer that had all the Service Pack 2 updates and then was upgraded to Service Pack 3. If this is the case then specific SP2 related sub folders located in C:\Windows\$hf_mig$\ serve no purpose and can be deleted.
Technical Detail: Note: You can skip this section if it holds no interest to you and continue reading at the section titled: “Installing High-priority updates to baseline #1”
SP3 ensures that your PC's software is located on the General Distribution Release (GDR) branch of patches rather than the Quick Fix Engineering (QFE) branch.
The .exe file is the uninstaller. The .txt file read like a .bat command file The .inf will identify why type of fix (QFE or GDR) You will notice that recent updates for SP2 users all take the QFE branch. The file updates and registry changes are also there for the pickins.
Windows Update generates a list of possible matches by using a MD5 hash value. Example: msadce.dll MD5: af9c8df96c7335acdd3ff89955a9f6d6
Sample contents of the Update.ver file located in each $hf_mig$ subfolder. sp2gdr\msadce.dll=AF9C8DF96C7335ACDD3FF89955A9F6D6 sp2qfe\msadce.dll=CC2ADBB0FB13CA659A169DF5A6182594 sp3gdr\msadce.dll=142CEDECAE89E372EE347681C3FBB257 sp3qfe\msadce.dll=1A1B23E422B4A7C6433C8962A090FE43
If you were to uninstall the update this is what takes place: DEL "c:\windows\$hf_mig$\kb958690\sp2qfe\win32k.sys" DEL "c:\windows\$hf_mig$\kb958690\sp3gdr\win32k.sys" DEL "c:\windows\$hf_mig$\kb958690\sp3qfe\win32k.sys" COPY "C:\WINDOWS\$NtUninstallKB958690$\win32k.sys" "c:\windows\system32\win32k.sys" COPY "C:\WINDOWS\$NtUninstallKB958690$\win32k.sys" "c:\windows\system32\dllcache\win32k.sys" COPY "C:\WINDOWS\$NtUninstallKB958690$\spuninst\spuninst.txt" "C:\WINDOWS\$NtUninstallKB958690$\spuninst\spuninst.tag"
Installing High-priority updates to baseline #1: (All $hf_mig$ sub folders remain as is, non were deleted) All SP3 updates released on or after May 2008 were installed with two exceptions: 1) .NET Framework 3.5 Service Pack 1 and .Net Framework 3.5 Family Update for .NET versions 2.0 through 3.5 (KB951847) x86. 2) Internet Explorer 8 for Windows XP.
Total of 39 updates, 60.8 MB
Installing High-priority updates to baseline #2: ( $hf_mig$ sub folders - selective deletion of SP2 related sub folders) All SP3 updates released on or after May 2008 were installed with two exceptions: 1) .NET Framework 3.5 Service Pack 1 and .Net Framework 3.5 Family Update for .NET versions 2.0 through 3.5 (KB951847) x86. 2) Internet Explorer 8 for Windows XP.
Total of 39 updates, 60.8 MB
Comparing the results of installing the High-priority updates to both baselines: A full years worth of Windows Updates were installed and the results of both sets of baseline tests were identical when comparing the CRC values and version numbers of the files contained in C:\WINDOWS\ and for good measure C:\Program Files. With the exception of some obvious files such as log files, prefetch files, temp files and of course the number of sub folders present in the $hf_mig$ folder.
Conclusion: This proves that you can in fact delete a selected number of sub folders located in C:\WINDOWS\$hf_mig$ without fear of changing the results when using Windows Updates. Once again the deletions where limited to those KB numbers detailed in this article: “List of fixes that are included in Windows XP Service Pack 3”: http://support.microsoft.com/kb/946480/
Is it worth the time and effort? The deletion of these $hf_mig$ sub folders could free up as much as 1GB or more of disk space.
Deleting the $NtUninstallKBxxxxxx$ folders can free up even more space: About 1.2GigaBytes or more additional disk space can be freed up. For more about the deletion of $NtUninstallKBxxxxxx$ folders click on the link at the end of this article.
With PC purchased with the last 5 years hard drive sizes range from 160GB on up to 500GB or more. The exceptions being laptops and entry level desktop computers where a PC only a few years old may still have a 40GB or smaller hard drive. For users who are limited by smaller size hard drive sizes freeing up 2GB or more space can make a difference. For the rest of us who have one or more large hard drives it most likely not worth your time or effort.