How to compact the SYSTEM hive of the registry?

Whenever I do something to my system (which otherwise works fine) that causes the SYSTEM-hive of the registry (i.e. the file C:\WinNT\System32\config\SYSTEM) to grow a few bytes I get a "loader error 4" during a subsequent reboot.

I have experimented by now with several different devices, which all used to work with the very same version of their drivers (e.g. it's enough to simply plug in a USB-device into a different port of my hub...) that I have come to the conclusion, that this is not actually a problem of a specfic driver nor some problem with one of the installation programs or such, but rather that I seem to have bumped into some size limit of the registry! I suspect, that I have reached some filebuffer size or some other limit so that my SYSTEM hive can not be loaded into memory during the very first boot phase (the one that starts with the black and white rectangles along the bottom of the screen).

My SYSTEM file is currently at 9'936 KB and I tried de- and re-installing a few devices, but whenever the SYSTE'file's size grows to 9'940 or beyond, I am hosed  and I get this darn "loader error 4". I then always copy down a backup of that file and I'm up and running again.

The idotic thing is: I *can* (re-)install new devices, and I even can use them - all fine - I only MUST NOT reboot after installing them, since then I get this darn "loader error 4" and have to copy back my old SYSTEM file.

So - in short: I want to compact and clean the SYSTEM hive of my registry: Is there any program out there, that really cleans and compacts the registry, particulary the SYSTEM part? I tried a few registry cleaners so far (Norton, MS RegClean, RegDrill, RegScrub, and a few others), but they all clean out only unused or false class definitions, left behind SW settings, dangling application paths, etc. which is all fine and usefull but all these changes eventually refer to stuff that sits in the SOFTWARE part of the registry, none of them so far cleaned anything, that caused my SYSTEM file to shrink.

Since I have attached tons of devices and gadgets to my system over the last couple of years I seem to have an abundance of obsolete drivers and device entries (e.g. when I go to Control Panel => Add/Remove Hardware Wizard => Uninstall/Unplug a device => Uninstall a device and then check the "show hidden devices" checkbox, I see TONS of devices that are obsolete and many others that appear 10, 15 or even more times (e.g. the MS mouse driver or some scan-pen that I use). How can one clean up the superfluous entries? Uninstalling these via the above dialog takes AGES and one always has to restart from the control panel again so I consider that not an appropriate way to remove 200 or more entries. There must be some faster way, e.g. by zapping the corresponding subtrees in the registry. But for that I would first need a decent description and a better understanding of how these devices and their drivers and settings are organized in the registry. Any good pointers on that subject?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Instead of "compacting" your registry, why not just give it more room?
For W2K/XP:

--Right click on my computer and go to properties
--select the Advanced tab
--click the Performance Options button
--under Virtual Memory, click change
--at the bottom, under Registry size, increase the maximum registry size.....I'd bet it is currently set at 10 mg.

For NT:
mmo18Author Commented:
Nope - its set to 75 MB (and the dialog you mention indicates that it's current size is at 60MB) and I already tried to give it 100MB (to see, whether that amount is somehow oddly "split" between the misc. hives) but that didn't cure that boot loader error. It seems (i.e. I read that in some other forum) that during the boot phase the SYSTEM part of the registry plus a minimal set of drivers and misc. other stuff have to fit into 16MB. That's seems to be the absolute minimum amount of RAM required to boot a Win2K system. That might explain the roughly 10MB limit for the system part of the registry...
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

mmo18Author Commented:
Hm - sounded good... However, it turned out that this is a procedure for Win NT 4. Win2K does not have an RDISK utility anymore - in Win2K the equivalent function was integrated into the NTBACKUP utility.

And with NTBACKUP the creation of a registry backup does not seem to reorganize or compact the files anymore: e.g. the SYSTEM file that I just created using NTBACKUP in C:\WinNT\repair\RegBack has a length of 9'932 KB (instead of 9'936 that my "active" registry has right now). So there seems to be no (or no significant) compaction or reorganization taking place with NTBACKUP (as seems to have taken place with RDISK - at least according to the article mentioned).

I also checked NTBACKUP's commandline options, but none seems to trigger a registry compaction...
JConchieCommented: may be that you are back to option 1.....getting rid of all the old garbage driver entries, matter what a laborious job that may be.......I've never run into a situation where increasing the amount of space available for the registry didn't cure this sort of a problem.......very interested if anyone else can come up with something here...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Answered.........although it may not have completely solved the issue.......hard to know without feedback from mmo18
mmo18Author Commented:
Hi there,
pre-christmas was too busy here, so I haven't yet found time to do the (presumably) laborious job and clean up my garbage drivers (as already foreseen by myself in my initial append...). I hope to get around doing that soon.
So, although JConchie didn't exactly solve my issue, I appreciated his effort. Give him 250 (i.e. half of the points) and the rest I keep for my next challenge...

Hope, JConchie finds that acceptable...
Fine by me, thanks. 250 pts and an "A" to me, refund 250 pts to mmo18
mmo18Author Commented:
Sorry - this is still pending. The problem is: How do I grant only a part of the points as discussed above? The "Split Points" page insists that I have to distribute ALL points (i.e. I can't "keep" points nor assign them to myself).
Go to community support, ask a zero point question requesting that the mods review this question (paste in the url of this question) and requesting that they award 250 pts and an "A" to me and refund the other 250 to you.

Mods, this arrangement is fine by me.
mmo18Author Commented:
Fine with me - thanks! And sorry to JConchie for having completely forgotten about him. I had intended to follow his slightly convoluted solution in a spare minute, but then completely forgotten about it.

If you get these errors and have tried every other option but have a copy of the software and system hiles either via using REGBACK or from tape, you can use the MS tool called CHKREG.EXE.

See the link

This has helped in the past where the hives have exceeded 'Microsoft's recommendations', cheers Bill!

The tool can be used to check and compress the hives.

See parameters below:

D:\Admin\Chkreg>chkreg /?
Checks a hive file and perform repairs, compacts or displays a status report.

CHKREG /F <filename[.<LOG>]> [/H] [/D [<level>] [/S [<bin>]] [/C] [/L] [/R] [/V]

    <filename>      FileName of hive to be analyzed
    /H              This manual
    /D [<level>]    Dump subkeys up to level <level>. If level is not
                    specified, dumps the entire hive. No checks are done
                    when dumping.
    /S [<bin>]      Displays space usage for the bin <bin>. When bin is
                    not specified, displays usage for the entire hive.
    /C              Compacts the hive. Bad hives cannot be compacted.
                    The compacted hive will be written to <filename>.BAK
    /L              Lost space detection.
    /R              Repair the hive.
    /V              Verbose Mode.

You will then need to copy them back through command console into the %WINDIR%\SYSTEM32\CONFIG folder.
TIP: rename the old ones, DO NOT OVERWRITE, just in case.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 2000

From novice to tech pro — start learning today.