Susie at Practical Penumbra is having problems defragmenting her hard drive because the defrag application keeps restarting in the middle of the process. As she correctly diagnoses, it's because something keeps writing to the drive as defrag is working. (Anytime new data is written to the disk, the basic defrag in Windows 98 and ME must restart to adapt to the new state of the drive.)
She suspects it could be her antivirus software that's causing the problem. but it could, in fact, be any number of different programs/applications. The only way to avoid the problem is to try to make sure that none of the offending applications are running.
The trick to doing this is to start up in Safe Mode, and run the defrag process from there. When you restart the computer, just start tapping the F8 key about once per second after it has started to boot. (There's an actual point where you're supposed to hit the key, but the timing is different on every machine, so easier to just start tapping early to make sure you catch it.)
What'll happen is you'll eventually get a screen offering you several methods to choose from for the boot, plus a blinking cursor. (If you get into normal Windows instead, just restart and try again as you missed the trigger point) Just check the list for the number that corresponds to Boot into Safe Mode (no network connection), and type that number at the cursor, then hit Enter.
The machine will go through a longer boot process (it'll probably scroll a huge number of lines down your screen while doing it) then will get to your desktop. Note that the screen will look wonky because Safe Mode uses the most basic driver configuration possible, so your screen will be a lower resolution with lower colour quality.
Just navigate to your defrag program the way you normally do, and run as usual. When you're finished, just re-start normally and go back to work.
The reason this usually works is that a Safe Mode boot only starts the most basic components of Windows necessary for the OS to operate. This means the service or program that was writing to the drive in the background has likely not been to allowed to activate yet, so can't interfere with the defrag process.
One other thing that can cause defrags to constantly restart is if there are errors on the hard disk. Depending on what version of Windows you are using, the defrag program should either do a disk scan for you as it's first step in the process (eg Windows 98) or it may prompt you to run a scandisk before running defrag (WinXP using Fat32). If you're prompted to run a scandisk first, do so before restarting defrag.
Lastly, if your disk was heavily fragmented, you'll usually get best results by running defrag twice. (The defrag built into Windows isn't especially sophisticated - 3rd party versions generally don't have these restart/multiple runs requirements, but they do cost a few bucks.)
For those who really want to get into it: The defrag utility built into Windows 98 unfortunately is agonizingly slow. The one in Windows ME is similar code, but runs substantially faster and better (less prone to restarts). The ME version is perfectly compatible with Win98, so you can certainly use a copy of defrag.exe from from WinME to replace the one in your Win98 install. I routinely do this for my Win98 customers who are having defrag problems, but don't want to pay for a 3rd party application. Technically, using this new file would be against Windows licensing agreements, but it's such a minor transgression that I can live with it - especially since it fixes a flaw in Win98 that Microsoft could and should have fixed themselves with an update.