Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

How to defrag all of your hard drives at the same time


  • Please log in to reply
7 replies to this topic
jballi
  • Members
  • 1029 posts
  • Last active:
  • Joined: 01 Oct 2005
If you want a computer that is in tip-top shape, you have to periodically defrag the hard drives. There is no getting around it. Most people hate to defrag because it's a pain in the butt and it takes FOREVER!, especially if you have a bunch of very large hard drives. Oh sure, the display on many defrag programs is cool but other than that...

Here's a tip that will allow you to defrag all of your physical hard drives at the same time. If you only have one physical hard drive, stop reading here. This tip won't save you any time.

Step 1
If you don't have it already, download a free copy of SysInternals' Contig program. You can find the program here:
http://technet.micro...s/bb897428.aspx.

Put a copy of the contig.exe file somewhere in the path. If you're not sure where to put it, the "C:\Windows" folder is a good spot.


Step 2
Create a batch file for each drive. The following is a template you can use. Change X: to the appropriate drive letter.
title Contig X:
contig -s X:\*.*
echo.
echo Contig of drive X: complete...
pause
Name the batch files appropriately so that you can easily find them later. I've named mine Contig_C.bat, Contig_D.bat, Contig_H.bat, etc.


Step 3 (Doing it!)
Before defragging, shut down all programs. If you're up for it, shut down all unnecessary services (not required but it might help a little).

For each drive, find and run the appropriate batch file.

Get a beer (soda for me) and go watch the last couple of innings/quarters/etc. of the game on the boob tube.


The Good, the Bad, and the Ugly
The Good
The obvious benefit is that the total defrag time is reduced significantly. You should be able to defrag multiple hard drives in same time it takes to defrag one. You can also defrag one drive while you're working on another. I have 4 drives and many times I defrag two of the drives while I am backing up or cloning the others.

The Bad
The bad? Hmm... Let me think about it for a while. I'll get back to you.

The Ugly
Oh yes, it's ugly. A few things...

[*:2u8npdb7]CPU. If you have more than two drives and the drives are badly fragged, these routines will eat your CPU alive. Personally, I don't see a problem with that but if you feel uncomfortable, you can always reduce the number of drives that you defrag concurrently.

[*:2u8npdb7]Logical vs. Physical. If you have a physical hard drive that has been partitioned into multiple logical drives, you still need to defrag each logical drive but you don't want to defrag them at the same time. The reason? Since the hard drive can only respond to one request at a time, multiple defragging jobs would have the disk drive jumping all over the place. It would still work but it wouldn't be very efficient. Bottom line: Only defrag one logical drive per physical disk drive at a time. Did I say that right?

[*:2u8npdb7]Defragging vs. Optimization. The Contig program is designed to defrag individual files. The program does not optimize the hard drive. "Optimize" can mean many things but usually the meaning includes moving all the files together to 1) improve access time for frequently used files and 2) create contiguous free space. What I do is defrag all of the drives first using Contig then I run the standard Disk Defragmenter on selected drives to optimize. Defragging first makes the Disk Defragmenter program run much faster. My rule of thumb is to defrag frequently (it provides the most benefit) and to "optimize" occasionally or "as needed".Final thoughts...
The Contig program has been around for many years and it uses native OS APIs to do all of the work so it's very safe. However, since it does make changes to your hard disk, please use with care and at your own risk.

I hope someone finds this information useful. Them be my thoughts...

Edit: Updated link.

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Contig is great. I made a suggestion to the author a couple years back and he was quick to implement it: that contig support defragging a directory (directories are a special kind of file). Since directories that contain thousands of files tend to be very slow to traverse/enumerate (such as by Explorer when you navigate into them), defragging them greatly improves their speed.

quatermass
  • Members
  • 220 posts
  • Last active: Dec 16 2013 09:00 PM
  • Joined: 14 Dec 2005

Contig is great. I made a suggestion to the author a couple years back and he was quick to implement it: that contig support defragging a directory (directories are a special kind of file). Since directories that contain thousands of files tend to be very slow to traverse/enumerate (such as by Explorer when you navigate into them), defragging them greatly improves their speed.



Pity David didn't add de-fragmenting free space as well.

Also Contig defrags alphabetically if used in a wildcard path call.

It would have been nice if it had the ability to take in a file list from say an analyse file. Then it could defrag the most fragmented first.

I used Contig for years to keep a NT server defrag'd. It mostly worked. But it took days to do it!

Still the source is available if people wish to mod it.
Stuart Halliday

Andreone
  • Members
  • 257 posts
  • Last active: Mar 19 2008 05:30 PM
  • Joined: 20 Jul 2007
You can find a nice gui for contig (called Power Defragmenter Gui)
at http://www.excessive-software.eu.tt/ (stand alone exe)

quatermass
  • Members
  • 220 posts
  • Last active: Dec 16 2013 09:00 PM
  • Joined: 14 Dec 2005
Shock Horror! And what is wrong with using it CMD or .BAT ? :lol:
Stuart Halliday

horsecharles
  • Members
  • 1 posts
  • Last active: Oct 03 2008 09:51 PM
  • Joined: 03 Oct 2008
On Vista...does it help significantly to boot to Safe Mode & run there?

TIA

Chavez
  • Members
  • 256 posts
  • Last active: Oct 13 2009 01:27 PM
  • Joined: 20 Aug 2008
Diskeeper Premium.
-Chavez.

SoLong&Thx4AllTheFish
  • Members
  • 4999 posts
  • Last active:
  • Joined: 27 May 2007
As posted by others as well http://www.kessels.com/Jkdefrag/
- free
- use as screen saver
- all drives
- schedule (via default task scheduler)
install, setup and never look back 8)