Windows XP Pagefile and Registry Defragmentation
Windows XP lacked built-in capabilities to defragment locked system
files, meaning the operating system could not natively perform offline
defragmentation on the paging file or the system registry. Because
Windows locked files such as pagefile.sys and active
registry hives exclusively during normal operations, users had to rely
on third-party tools, boot-time utilities like Sysinternals PageDefrag,
or manual configuration workarounds to eliminate fragmentation in these
critical system areas.
Native Windows XP Limitations
The built-in defragmentation utility included with Windows XP was a stripped-down version of Executive Software's Diskeeper. It operated strictly within the user-mode environment while the operating system was fully loaded. As a result, it could not access files held open with exclusive locks by the Windows kernel. The Master File Table (MFT), the paging file, and registry hives remained untouched by the default defragmenter, gradually accumulating fragments over time as the system was used.
Sysinternals PageDefrag
The most widely used solution for offline defragmentation in the Windows XP era was PageDefrag, a freeware utility developed by Mark Russinovich and Bryce Cogswell at Sysinternals (later acquired by Microsoft).
PageDefrag bypassed operating system file locks by executing during
the boot process before the Win32 subsystem and primary kernel file
locks were fully established. It hooked into the
BootExecute registry key (the same mechanism used by
autochk to run chkdsk). During startup,
PageDefrag scanned the system's paging files, event log files, and
registry hives (SYSTEM, SOFTWARE,
SAM, SECURITY, and user profile hives). If
these files were fragmented, it consolidated them into contiguous
clusters on the disk before Windows XP fully loaded. Users could
configure it to run once on the next reboot or automatically on every
system start.
Commercial Boot-Time Utilities
Users seeking comprehensive disk maintenance often turned to
third-party commercial defragmenters, such as full retail versions of
Diskeeper, Raxco PerfectDisk, or O&O Defrag. These programs included
dedicated boot-time drivers that loaded early in the startup sequence.
Unlike the native Windows XP utility, these tools performed full offline
defragmentation passes, consolidating not only the registry hives and
the pagefile, but also the Master File Table (MFT) and hibernation file
(hiberfil.sys).
Manual Workaround for the Pagefile
For administrators unable to install external software, Windows XP
offered a manual workaround specifically for the paging file. By setting
the pagefile size to zero across all drives and rebooting, the operating
system would delete pagefile.sys. The administrator could
then run the standard defragmenter to consolidate free space, and
subsequently recreate the pagefile with identical minimum and maximum
size values. This forced Windows XP to allocate the pagefile as a
single, contiguous block of disk space, preventing future fragmentation
without requiring an offline defragmentation utility.