Bypass Windows 98's never-ending defrag operation

 

Summary

Greg Shultz shares on how to get around a stalled defrag operation in Win98.

Events

Echelon 2012
June 11 and 12, 2012

University Cultural Centre, National University of Singapore

Startup Asia Jakarta 2012
June 7 and 8, 2012

12th Floor, Annex Building, Wisma Nusantara Complex, Jl. M.H. Thamrin No. 59 Jakarta 10350, Indonesia

MMA Forum Singapore
April 23-25, 2012

Grand Hyatt Singapore


This article originally appeared in TechProGuild.

If you're supporting the Windows 98 operating system, chances are that you've encountered the mind-numbing problem in which Disk Defragmenter is unable to complete a defrag operation. In this situation, Disk Defragmenter works normally until it gets to about the 10 percent complete marker. Then, it stops and displays a message like the one shown in Figure A.

Figure A: Disk Defragmenter never gets past the 10 percent complete marker before it starts all over again.

When this happens, the logical thing to do is to stop Disk Defragmenter and make sure all open applications are shut down, even those that run in the background, and then rerun Disk Defragmenter. However, once Disk Defragmenter hits the 10 percent complete marker, it again displays the same message and starts all over at the beginning of the hard disk. At this point, you may even restart the system in Safe Mode and try running Disk Defragmenter from there. Again, Disk Defragmenter starts over when it hits the 10 percent complete marker. This scenario plays over and over no matter what you do.

Fortunately, I've discovered an interesting technique that takes advantage of a hidden tool buried on the Windows 98 CD. This technique will bypass all these drive contents change interruptions and allow Disk Defragmenter to perform a full defragmentation operation on a Windows 98 system that is experiencing the never-ending defrag operation. In this article, I'll examine the cause of this problem in more detail, as well as introduce you to my full defrag technique and explain how it works.

A theory for the never-ending defrag operation
While many of my IT colleagues have offered all sorts of theories on what causes Disk Defragmenter to choke at the 10 percent complete marker--everything from a Microsoft plot to drive users nuts to the tidal effects of the moon--I’ve never been able to find a definite answer. And, yes, I even investigated the Microsoft Knowledge Base, which roots the problem in active applications accessing the hard disk and suggests shutting down all running programs. However, I’ve experienced this problem firsthand many times and found that none of the obvious explanations seems to offer a solution to the problem of the never-ending defrag operation.

Over the years, I developed my own theory and solution, which after time-tested examination, seems to be as good an explanation as I’ve encountered. In order to get a handle on what is causing Windows 98’s Disk Defragmenter to choke at the 10 percent marker, I began to investigate how this utility goes about doing its job.

There are basically three stages that Disk Defragmenter goes through when defragmenting your disk. Each of these stages can be demarcated at the percent complete values that Disk Defragmenter displays in its status bar. During the 0 and 4 percent complete values, Disk Defragmenter is actually running a special version of ScanDisk for Windows in order to check the disk for errors before doing anything with the files. If an error is found, Disk Defragmenter halts operation and prompts you to run the ScanDisk for Windows. If no problems are found on the hard disk, Disk Defragmenter enters the next stage. During the 5 to 9 percent complete values, Disk Defragmenter is essentially plotting out a road map of the best locations on the hard disk to use when it actually begins moving the files.

Once these preliminaries are complete, Disk Defragmenter begins moving the files and placing them in contiguous order on the disk. This stage begins at the 10 percent complete value and continues on to the 100 percent complete value. When Disk Defragmenter has a problem at or around the 10 percent complete value (which causes the utility to stop, display the error message, and start all over), it’s apparent that Disk Defragmenter is encountering a problem when it begins moving chunks of data that it finds somewhere towards the beginning of the hard disk.


A quick restart
When Disk Defragmenter encounters a problem that causes it to restart, you’ll notice that it very quickly moves past 0 to 4 percent complete values and picks up where it left off. This is because the ScanDisk activity occurs only when Disk Defragmenter is started and is not repeated if Disk Defragmenter is forced to restart because of disk activity.


In almost all cases, the chunks of data at the beginning of the hard disk are unmovable areas belonging to the swap file associated with Windows 98’s Virtual Memory management scheme. My research and the success of my solution leads me to believe that the cause of the “Drive contents changed: restarting…” message is a combination of Disk Defragmenter itself and Windows 98’s Dynamic Virtual Memory management scheme.

When Disk Defragmenter encounters the swap file, it will bump into a very large chunk of the hard disk marked as unmovable and will have to begin moving large chunks of data all around it in order to place files that fall before and after the swap file in contiguous order. As this occurs, Disk Defragmenter seems to depend on the swap file to assist the utility in the data move operation. If the swap file itself is heavily fragmented, then Windows 98, with its Dynamic Virtual Memory management scheme, must make adjustments to the size of the swap file. When this occurs, there is obviously hard disk activity that causes the drive contents to change and thus causes Disk Defragmenter to start all over.


Configuring Disk Defragmenter to automatically disable screen saver
If you want to ensure that the screen saver does not launch while you are defragmenting your hard disk, you can configure Disk Defragmenter to automatically disable the screen saver when it is running by adding a little setting to the registry. To begin, you’ll launch the Registry Editor by typing Regedit.exe in the Run dialog box. Once the Registry Editor is up and running, navigate through the following subkeys:

  • HKEY_CURRENT_USER
  • Software
  • Microsoft
  • Windows
  • CurrentVersion
  • Applets
Now, right-click the Applets key and select New | Key. Name the new key Defrag. Next, right-click the newly created Defrag key and select New | String and name it Settings. At this point, double-click the Default value inside the Settings key and change the value to YES. To complete the operation, close the Registry Editor and restart Windows 98. Once Windows 98 restarts, you will be able to run Disk Defragmenter without worrying about interference caused by the screen saver.

The solution: An overview
Working with this theory in mind, I discovered this solution to the problem of the never-ending defrag operation. To begin, disable virtual memory completely. Then use the hidden tool to configure Windows 98 to automatically run Disk Defragmenter on startup, but before the operating system is completely initialized. Once Disk Defragmenter completely defragments the hard disk, all the empty space is at the end of the disk. You then reenable virtual memory, which forces Windows to put the swap file at the very end of the hard disk. Here are directions on all of these steps.

Disabling virtual memory
Disabling virtual memory is a relatively simple operation. To begin, open Control Panel and double-click on the System icon. Then, select the Performance tab and click the Virtual Memory button near the bottom of the tab. At this point, you’ll see the Virtual Memory dialog box shown in Figure B.

Figure B: The Virtual Memory dialog box allows you to alter the swap file.

Next, select the Let Me Specify My Own Virtual Memory Settings option. When you do, you’ll see that the settings below it become active, as shown in Figure C.

Figure C: When you select the Let Me Specify My Own Virtual Memory Settings option, the settings are enabled.

Now, select the Disable Virtual Memory check box. To complete the operation, click OK to close the Virtual Memory dialog box. As soon as you do, you’ll see the Confirm Virtual Memory Settings dialog box, as shown in Figure D.

Figure D: You’ll be prompted to confirm the change you made to the virtual memory settings.

You’ll notice that this confirmation dialog box carries a stern warning about completely disabling virtual memory. In addition to the warning that computer performance may decrease significantly, the message also warns that you may be unable to restart your computer.

As far as the performance warning is concerned, yes, your system will not be performing optimally. However, since for this technique it's only a temporary change, that isn’t a big concern. As to the warning about not being able to restart your computer, I can tell you that I’ve never encountered this situation. However, that’s not to say that it won’t happen. Just in case, you should be prepared to work through this scenario. Having a Windows 98 Startup Disk on hand should be all you need to get the system back up and running.

Once you click Yes to confirm that you do indeed want to continue, you’ll return to the System Properties dialog box. To continue, click Close. You’ll then be prompted to restart your computer. However, you need to click No.

Installing the hidden tool
In order to install the hidden tool, you’ll need to have on hand a Windows 98 CD. Once you insert the CD in the drive, you’ll see the Windows 98 CD-ROM menu. Select the Browse This CD option. When you see Windows Explorer, drill down to the Tools\Mtsutil folder. At this point, locate and right-click the Defrag.inf file. Then, select the Install command from the shortcut menu. When you do, you won’t notice anything happening. However, in the background, the install operation adds the special command, Defrag/All, to the RunServicesOnce key in the Registry.


It’s a one-time deal
Keep in mind that, as the name implies, the change to the registry implemented by the Defrag.inf tool will only be effective once. It will be automatically removed after the command is launched.


To continue, close Windows Explorer, the Windows 98 CD-ROM menu, and any other open windows. Then, restart Windows 98. When you do, Windows 98 will begin to start normally, but then before the operating system is completely initialized, Disk Defragmenter will launch before anything else loads from the registry, the StartUp folder, or the Win.ini file. It will then be able to complete the defragmentation operation uninterrupted. Once Disk Defragmenter completes its job, close it down and let the system start normally. You’ll then need to reenable virtual memory.

Reenabling virtual memory
To reenable virtual memory, return to the Virtual Memory dialog box, as described earlier. Then, select the Let Me Specify My Own Virtual Memory Settings option and click OK. When you do, you’ll see the Confirm Virtual Memory Settings dialog box and will want to click Yes. To complete the operation, close the System Properties dialog box, and click Yes when you’re prompted to restart your system.


Copy the shortcut
If you’d like to be able to defragment your hard drive regularly using this technique, you can copy the Defrag.inf file to a folder on your hard drive. That way you can access it quickly and easily the next time you want to perform a defragmentation operation.


Talkback

Any suggestions on where I can go to download defrag.inf? I am unable to locate the CD that you speck of...and I have been unable to find a downloadable version. Regardless, thanks for your article.

bill April 11, 2005

When I set up to run the disk defrag the pause button is on and the system is frozen and will not activate. Any suggestions how to fix?
thanks.

joe pare May 4, 2005

You don't need the defrag.inf file. You can use the defrag.exe file in the windows driectory, and create the registry key yourself. In the registry editor, go to the LOCALMACHINE/SOFTWARE/MICROSOFT/WINDOWS/CURRENTVERSION/RUNSERVICEONCE folder. Then enter your own string by right clicking in the right hand window, selecting new - string. Double click on the string you just created and enter C:WINDOWS/DEFRAG.EXE as the value for that string. Then exit the registry and restart your computer. The defragmentation software will come up before you log in. Don't forget to do the vitual memory shut down outlined in this article. It all worked for me.

Corrie Block December 22, 2005
Add your opinion

In order to post a comment, you need to be registered. (Sign In or register below)

Post your comment

ZDNet Asia Live

Fanboys on AV for Mac: "ludicrous" "a waste of time" "The Mac will protect me" "the most secure ever" "impenetrable" http://t.co/a1o2Sz7E

RT @ameliatmy: the hottest angel investment & venture capital event in #MALAYSIA! will u be there? http://t.co/ChSjkmzu #ABAF

Singapore Game Box in the ZDnet news!
http://t.co/UuTs0SqX http://t.co/YdPKmm39

#radio Radio Bolivia by EnjoyIT 1.0 http://t.co/fdlBPOeI

RT @zdnetasia: SingTel acquires HungryGoWhere for US$9.4 million. http://t.co/Qho1REVZ

Gartner: Mobile CRM gives better ROI than social - http://t.co/s5OfTAXK #CRM

RT @zdnetasia: S'pore sets up portal to grow games sector. http://t.co/In8gtj7L

#Malaysia: 20% yoy rise in overall #wages for both direct and non-direct labor. http://t.co/5T2e0LUU

RT @mikebuetow: #Malaysia: 20% yoy rise in overall #wages for both direct and non-direct labor. http://t.co/5T2e0LUU

@88tc88 RT @KevinZDNetAsia: User experience more important to app monetization than actual content http://t.co/ogbD5wyI… #li #dm12

Dubbed the first social #Olympics, this year's summer games have some of the strictest social rules for all involved http://t.co/4HlcqhW3

Value of big data analytics largely untapped - Zd Net http://t.co/ZuhPrCN4: Pushing cloud limits for d... http://t.co/VyOU0vHz #TheBIBlog

Value of big data analytics largely untapped http://t.co/026PCpSc @zdnetasia

RT @data_nerd: Value of big data analytics largely untapped http://t.co/026PCpSc @zdnetasia

Active WebTraffic - Downloads - ZDNet Asia: Active WebTraffic is a web promotion tool that includes ... http://t.co/fMJepPh8 #webtraffic

So much as we know , MTK6575 extremely integrated frequency1GHz ARM Cortex-A9 processor, the superiority of 3G / HSPA Modem, and help the...

14 hours ago by y15822137359 on 5 SaaS adoption speed bumps to avoid

I reckon your view: "CRM is strategy, not software", if a company replicating the approach uses in ERP implementation into CRM, what they...

1 day ago by wykoong on Gartner: Mobile CRM gives better ROI than social

This video will teach you about the Excel fill handle but also provide you with a workook to download... http://www.youtube.com/watch?v=...

2 days ago by TradeBrother on A quick fill handle trick for Microsoft Excel

waiting...

4 days ago by eapete on What should count in a company's market value?

Boy, you've opened a can of worms now.

Wait for the rants & raves.

4 days ago by eapete on What should count in a company's market value?

I was puzzling before this whether to replicate the success formula we executed for a financial institute, and come out with a standard s...

4 days ago by wykoong on Drop the egos, copy ideas, then innovate