Windows 2000 & XP
How to Safely Compact, Backup and Defragment your Registry

Introduction

In this brief "How-To" guide, I am going to show you how to simply, safely and automatically backup and keep your registry optimized and defragmented. I will not discuss issues around tweaking your registry - that is not my purpose in this brief guide, and is a much broader question. Frankly, I don't tweak my registry much, for the most part, Windows XP does a reasonably good job of optimization for most systems, and many tweaks do more harm than good. Furthermore, I strongly recommend against using automatic registry tweakers - in many cases they will do little good, make either unnecessary or incorrect registry changes, and can, many times, hose your system completely. Unless you are very experienced, and use the tools discussed in this guide, don't do automatic registry tweaking - you are just asking for trouble.

What You Will Need ...

You will need the following two safe and free tools to accomplish backup, recovery, compaction and defragmentation of your registry files. First ERUNT from here:

http://www.larshederer.homepage.t-online.de/erunt/

And second, PageDefrag from here:

http://www.sysinternals.com/ntw2k/f...agedefrag.shtml

Both are very simple to use, I have been testing both for some years,and have never had any problems with either of them. Simply put, they work, and can save you many hours of problems and even a full system reinstall.

ERUNT

ERUNT has two tools, ERUNT itself, and NTREGOPT

ERUNT is used for backing up and restoring your registry safely and quickly. Included with ERUNT is a readme.txt file with clear, detailed instructions for restoring your registry in a variety of circumstances, so I won't repeat those instructions in this short guide. Simply install ERUNT, and it automatically sets up a daily registry backup for the first boot each day to a folder located at C:\WINDOWS\ERDNT\AutoBackup. Each backup is stored in a separate sub-folder. You can keep several, I generally keep two or three days worth, and every once in a while delete the old ones. You should note that it saves all your registry files, as well as a map of their original locations and a copy of the restore tools you will need to restore your registry using any of the methods contained in the aforementioned readme.txt file. You can also manually run ERUNT whenever you want, and choose to either overwrite that day's backup or create a new folder. I should also note that the automatic daily backup adds no more then a second to your boot times, so doing a daily automatic backup is wise indeed.

NTREGOPT simply rewrites your registry files, deleting blank spaces in the various files. Blank spaces? Well, simplistically, the registry files are essentially specialized highly protected formatted text files. As your system uses the registry files, adding and deleting hardware, software and user information, parts of the registry are blanked out as old keys are deleted and new ones added. With a fresh install of XP and all the usual updates and hardware drivers, as much as 5% - 10% of the registry files can be made up of blank sections. Since a normal size registry "file" is in the 25mb to 30mb size, that can mean a fairly large amount of blank space is contained within your registry. Deleting those blank spaces permits Windows to use and read the registry files more efficiently. It is perfectly safe to delete these blank sections, and NTREGOPT does this by rewriting the registry files without the blank areas. In effect, it refreshes the structure of the registry files and compacts them to only used file space. Again, I have used NTREGOPT frequently, and it does work completely safely. I usually run NTREGOPT once a week - it only takes about a minute, and generally it reduces the size of the registry files by 1% - 2%. After running NTREGOPT, you will need to reboot. After successfully rebooting, I generally run ERUNT and save a new copy of the compacted registry files. However, when writing the new compacted registry files with NTREGOPT, they can become fragmented, and that is not desirable either. That's where PageDefrag comes into play.

PageDefrag

PageDefrag, from Systernals, defragments your registry files and page file during the early part of the boot process before they are protected by Windows. To install PageDefrag, simply unzip it, and copy pagedfrg.exe and pagedfrg.hlp to your C:\ root directory. Double click on it, and choose to defragment every boot. Again, this only adds a second to your boot times, as long as you set the "countdown" to 0, which I do. Every time I boot, it defragments the registry files and the page file. Generally these files do not become fragmented, but running NTREGOPT can fragment the registry files somewhat. The page file rarely becomes fragmented once it has been defragmented the first time, and never fragments if you use a fixed size page file. But, if the page file (or a registry file) is not fragmented, PageDefrag simply ignores the file, so that adds zero time to the boot process. Note too, if you are going to do an "offline" defragmentation using something like PerfectDisk, you must turn PageDefrag off before rebooting to do the "offline" defragmentation, as PageDefrag and "offline" defragmentation conflict with each other. Simply double click on PageDefrag, turn it off, reboot and let the "offline" defragmentation happen, and then after the reboot, double click on PageDefrag and turn it back on.

Conclusion

By using ERUNT, NTREGOPT, and PageDefrag regularly you will keep your registry files in optimal condition, and at their minimum possible size. These procedures are safe, as I said I have used them for quite some time, and they do help make your system more efficient and a bit faster. I also want to point out that using these tools do not replace the need to do full (and incremental) system backups regularly.