Ask Leo! by Leo A. Notenboom

How do I defragment my new hard disk?

Search First! Then browse: Categories | Full Archive | By Date | Newsletter

Home » Hardware

Summary: Defragmenting is a useful bit of maintenance to keep your hard disks speedy. It's not always needed, though. We'll look at when, and how, to defrag.

How do I defragment my new E: drive? Or is that not something that can be done?

Can be done? Absolutely, and I'll show you how I go about it.

The real question is: do you need to? If the drive's new, that answer's probably no. I'll explain why, too.

First, let's review just what defragmenting is. When files are stored on a hard disk, they are stored in pieces (called sectors or clusters) that could be scattered all over the hard disk. The first part of a file could be on the inner ring, the next could be on the outer and the next somewhere in between, and so on. In order to read the file in order, the hard disk's reading mechanism or "head" must move to each of those locations in order. If a file is really spread out around the hard disk, it's "fragmented", and can cause a lot of head movement which, in turn, can slow down the speed at which your hard disk appears to deliver files.

Defragmenting is nothing more than rearranging the pieces of every file so that they are physically in order on the disk - in other words they're very near each other, and reading a single file requires little or no head movement and can happen at maximum speed.

While the operating system does try to arrange files optimally, things still can become fragmented over time, so it's a good idea to defragment them every so often.

Now, about your new hard disk.

Think about what defragging is - it's all about rearranging files on the disk. If the disk is empty there are no files. If there are no files, there's nothing to defragment.

So if you just got a new empty hard disk, there's no need to defragment it.

Now, let's say it's an older disk in need of defragging. There are two ways to go about it, in Windows XP.

Use the Command Line

This, to me, is one of the easier ways to do it. Click on Start, then Run, type in "CMD" and press OK.

"If the disk is empty there are no files. If there are no files, there's nothing to defragment."

In the resulting command prompt, type defrag e: where "e:" is the drive you want to defragment. The result should look something like this:

Defrag command in Command Window

It'll first do an analysis, reporting on just how fragmented the hard disk is, and then go on to defragment the hard disk. You can see that this disk I used as an example, is fairly fragmented. It's my backup disk, so it doesn't matter as much, but I should probably let the defragmenter run.

Use the GUI

Naturally there is another user interface within Windows to defragment hard disks that doesn't require using the command line.

Right click on My Computer and click on Manage in the resulting pop-up menu. You'll get a window much like this one:

Computer Management Window

Click on Disk Defragmenter, and (perhaps after resizing the window so that all drives show) you'll see something much like this:

Defragmenter User Interface

Here you can click on the drive you wish to defrag, and press the Defragment button to begin the process.

The Third of Two Ways

I know, I said there are two ways to go about defragging your hard disk, and I've listed both of them above. However, there's another approach that doesn't use a defragmenter at all, yet ends up with the same result.

There are two catches: it can't be used on system drives, and you need enough room on some other drive to hold everything that was on the drive you want to "defrag".

This method relies on two principals:

  1. an empty drive is, by definition, "defragmented"

  2. when writing files to disk, the operating system tries to write them contiguously (not fragmented) as long as something else doesn't get in the way

By now, you can probably guess where this is going.

Here's the "poor mans defragger" in three simple steps:

  • Copy everything off of the drive you want to defragment. This means you, somewhere, have enough disk space elsewhere to hold the entire contents of your drive. Make sure to copy "system" and "hidden" files and all folders from the drive.

  • Empty the drive. Delete everything from the root of the drive on down, and empty the recycle bin. Alternately, perform a quick format of the drive.

  • Copy everything back to the drive. Don't access the drive in any other way while this copy progresses.

That's it. If you now run one of the defragmenting analysis tools, you should find that the drive is totally, or nearly totally, defragmented.

And remember, you cannot use this type of defrag on your system drive - the drive containing Windows. You won't be able to copy everything off, and deleting everything will a) not work, and b) crash Windows in the process.

What I Recommend

My machines are busy, and they're on all night, so one of the things I do is run the "defrag" command line tool every night while I'm not using the machine. (Though, I obviously don't run it on my backup drive.) While nightly might be a little overkill, I actually recommend some kind of automated defrag every so often - say once a week or so - if you use your computer a lot.

For more typical users, firing up the defragmenter's Windows user interface every so often makes sense. Particularly if you notice your system slowing down, and even more so if you notice it slowing down in conjunction with a lot of hard disk activity.

Related:

Helpful? Get new articles weekly by email in my FREE newsletter!

Your Name:
Your Email:


Why Subscribe?

Article C2866 - December 9, 2006

Recent Comments
14 Comments

This article is great! Not my main problem, but soon would be an issue!
Thank you,
Sandy

Posted by: Sandy at December 16, 2006 10:40 AM

Not too many years ago, PC World magazine had a small article about some benchmark testing performed in their labs, done both before and after the HDD's were defragmented. Their findings were that there was very little (if any) improvement in performance after the drives were defragmented.
They would mention it in subsequent articles, but I don't recall seeing it very recently. Maybe the findings were too heretical (like when it was first suggested to the medical community that washing hands prior to surgery could increase the success rate of patients' recovery).

Posted by: Sam at December 16, 2006 2:13 PM

Personally I use the FREE "Contig": http://www.microsoft.com/technet/sysinternals/utilities/contig.mspx program from Sysinternals for the occasional defragmenting of separate directories/sub-directories, basically because it allows users to defragment a single directory or even a single file (in fact, it's the first program that I've seen that is able to do that, and so far the only one); I mainly use it in an "automated" way, i.e. with the use of batch-files.

But for the so-called "on-the-fly" defragmentation, I use an also FREE "Buzzsaw" program: http://www.dirms.com/home/docs/buzzsaw.asp program from DirMS site (here's also a link to its page at Download.com: http://www.download.com/3000-2094-10198524.html ); this one is a GUI program and it monitors the hard-disk usage level and waits one minute before attempting to defragment a newly fragmented file, and additionally, it doesn't defragment the file untill the hard-disk's usage is less than 5% for some time (I think that's 1 minute or so), however, I don't really like the newer "service versions" of the program that additionally require (free) registration. That's why I use an outdated non-service version 2.0.0.2, that still works perfectly fine.

P.S. -- And by the way, there is also another defrag-program from the same site/author as Buzzsaw, a CLI program called "Dirms": http://www.dirms.com/home/docs/dirms1.asp , which is same as "Contig" an "on-demand" type of defragmenter; this one first offers users to do a free space evaluation, then defragment and/or move the files to the front of the drive (optionally accordingly to the files' modification-dates), and can additionally also compact them, i.e. it minimizes the small spaces between the physical file-locations of files as stored on hard-disk.

________

best regards,
Ivan Tadej, Slovenia
http://tadej-ivan.50webs.com/

Posted by: Ivan Tadej at December 21, 2006 5:04 PM

Shouldn't one check their disk with "chkdsk" before defragmenting their hard drive?
A third way to run the defrag.exe program is to open Windows Explorer, right click on the drive that one wishes to defragment, e.g. (C:), left click "Properties" in the context menu, left click the "Tools" tab and then in the "Error-checking" box, click on "Check Now". One has the options of just a disk check, or a repair, or both the next time the computer re-boots.

Posted by: C. Baker III at December 27, 2006 11:30 PM

To clarify my previous post: I meant to explain the third way to DEFRAG a Win XP computer. I inadvertently used the instructions on how to use CHKDSK. One can still use this Property Dialog to defragment the hard drive, too. Sorry, it's been a l...o...n...g holiday.

Posted by: C. Baker III at December 28, 2006 1:57 AM

An excellent "defrag program " is PerfectDisk by Raxco.I have tested this program for sometime now and it appears to work quite well,also defrags system files & boot files...

Posted by: Professor at December 28, 2006 7:21 PM

I go to start, all programs, accessories, system tools then disc defragmenter. When I try to defragment I get the message (Please run chkdsk /f. This message comes up whether I click on analyize or defragment.


dale

Posted by: dale at September 25, 2008 6:19 PM

Is anybody know how I can defragment a single directory (or selected directories), but NOT selected files.
I have Raxco Perfect Disk, but it can defragment only selected files, but not selected folders.

Best regards,
Dave (MillioZine.com)

Posted by: David at December 27, 2008 4:36 PM

hi i'm using my admins account but still i'm unable to defragment my harddisk

Posted by: raj at October 27, 2009 11:48 PM

is it okay to defrag hdd while OS is not running.
i want to use Paragon Total Defrag 2010 boot disk.
is there a difference between defraging inside or "outside" OS.
pls. advice.thanks

Posted by: Danny at November 20, 2009 9:12 AM

Post a comment on "How do I defragment my new hard disk?":






(Email Address will not be published.)

Remember Me?

By popular demand...
my tip jar
Cuppa Joe
Buy Leo a Latte!

(you may use HTML tags for style)

RSS feed Subscribe to the RSS Feed specifically for comments on this article.

Before commenting, please...

  • Read the article at the top of this page. If your comment shows you didn't, it'll be deleted and ignored.

  • Comment only on this article. Use the Google search box at the top of the page if you have a question about something else.

  • Don't include personal information in the comment. No email addresses. No phone numbers. No physical addresses.

  • Don't spam. Excessive links to unrelated sites within a comment or across multiple comments will cause all such comments to be removed.

  • Don't ask me to recover lost passwords or hacked accounts. I can't, and those comments will be deleted.

  • I can't respond to every comment. And I can't vouch for the accuracy of others who do.

Please wait. Your comment is being processed ...


Question? Ask Leo!