Nearly every techie knows how to defragment a hard drive. What’s not so well known is how to respond when the defragmentation utility keeps restarting. TechRepublic member Atvnut experienced such a problem and turned to our Technical Q&A for help.

“I have a problem with an IBM Aptiva E series 270 computer,” Atvnut wrote. “When I try to run the systems defrag tool or Nuts & Bolts Defrag, they keep restarting because of disk activity. I have shut down all running programs in the close program box except for Explorer. I am stumped.”

TechRepublic members quickly responded to Atvnut’s post with helpful information. Read about what they had to say, along with my advice on the two main reasons a defragmentation process will continuously restart: disk activity and low system resources.

Eliminate disk activity
Although applications or background services are the most common cause of disk activity, power management tools, screen savers, and antivirus software can also trigger a PC’s hard disk. The problem seems to have gotten better over the years, but many antivirus applications still cause problems due to their attempt to scan every file that’s being defragmented.

The obvious solution is to temporarily disable any application or service that could prove to be disruptive, prior to running the defragment procedure. “Make sure all programs in your system tray are closed,” wrote Kim123.

Andyrew322 reminded Atvnut to also check the settings of any monitoring applications that may be running in the background. “I have ASUS probe that monitors my system (i.e., CPU temperature, voltage levels); if you have something like that and can change the interval levels in which it scans your system, then increase it as much as you can.”

Unfortunately, there is no central menu from which you can disable everything. Your best solution is to boot in Safe Mode while defragmenting. Member TimTheToolMan agreed, but also suggested Atvnut take the process one step further. “The best way to ensure all files are closed is to boot to DOS off a floppy. If your defragger will run off a floppy, then that would be the best solution.”

Free up some system resources
Before you go through the trouble of booting to Safe Mode every time you want to run defrag, though, consider how low system resources can also crash the defragmentation process. Switching to Safe Mode frees memory because many services and drivers aren’t loaded. However, switching to Safe Mode does nothing to recover lost disk space, as member Pinoy_Teknik pointed out. If the hard disk is too full, the defragmenter still might not run properly. Before switching to Safe Mode, try to delete any files you don’t need. For example, you might delete temporary files and empty the Recycle Bin.

I also recommend temporarily disabling the system’s virtual memory and erasing the PAGEFILE.SYS file. Doing so will make your system run slower, but you’ll temporarily free up a lot of disk space for the disk defragmenter to use. You also eliminate the chance of disk activity caused by swapping data between memory and virtual memory. If you have a lot of free disk space on another partition, you can accomplish the same thing without slowing down the system by moving the swap file to another partition rather than completely deleting it. Even if you choose to move the swap file, you must still manually delete the PAGEFILE.SYS file from the original partition before you’ll be able to recover any disk space.

More defrag tips from Microsoft

If you have trouble defragging a Windows hard drive, member Alpha-Male suggests Microsoft Knowledge Base article Q186978. You should also try Knowledge Base articles Q218160 and Q259030.

The procedure for moving or disabling your virtual memory depends on what version of Windows you’re running. However, the procedure involves opening Control Panel and double-clicking on the System icon. Then, select the Advanced tab on the System Properties sheet. Click the Performance Options button to access the virtual memory settings.

The PAGEFILE.SYS file that I described is hidden by default, so you’ll have to configure Windows to show hidden files before you’ll be able to see and delete it. You can do so by selecting the Folder Options command from Windows Explorer’s Tools menu. Doing so reveals the Folder Options properties sheet. The properties sheet’s View tab contains all the necessary options for working with hidden files.