LyraTechnicalSystems.com » Blog Archive » Moving the Unmovable: Windows Disk Defragmentation Strategies

Posted on July 03, 2008 in How-to

One problem you may encounter in using the Windows Defragmenter program is “unmovable files” (the green bars) placed in an inconvenient location (on the right side of the display, at the end of your disk). The two most common “unmovable” files are the Windows operating system paging file (pagefile.sys) and the hibernation file (hiberfil.sys) that is used to store system state when the XP operating system goes into “hibernate” mode. An easy solution is to temporarily remove these files, then reinstall them after you’ve resized the NTFS partition.
To temporarily remove pagefile.sys, open the Windows Start menu, right click on MyComputer, select Properties, the Advanced tab, the Performance Settings button, the Advanced tab, and the Virtual Memory Change button (on some versions of XP, you’ll click a Settings button in the Performance box, then click the Advanced tab) . Change the virtual memory size to 0 and click OK to save your changes (select “No paging file” and click Set then OK on some XP versions).
To temporarily remove hiberfil.sys, go to the Windows Control Panel, select Power Options, click the Hibernate tab, and unselect “Enable Hibernation.”
After performing these steps, reboot your system and rerun the Windows Defragmenter. You should no longer see any “unmovable” files, and the final defragmentation result will be much better.
If you’re lucky, preparing your NTFS for resizing will be no more challenging than this. However, when I converted my HP Pavilion desktop to a dual-boot XP/Linux system, preparing the disk for repartitioning was considerably more complicated, and could not be accomplished using only the Windows Defragmenter. There, I had to cope with a Master File Table (MTF) disk area and many boot-related files that were located at the end of the disk. The Windows Defragmenter cannot move these files. To complete the necessary defragmentation I downloaded a trial version of Raxco Software’s PerfectDisk. It proved capable of defragmenting the disk in entirety, though to do this it had to perform a boot time run where it moved the scattered boot fragments from the end to the start of the disk before allowing XP to boot.

Last but not least, remember to reinstall virtual memory (a pagefile.sys file) and, possibly, the hibernation option (hiberfil.sys) after your defragmentation has completed.