Helping people with computers... one answer at a time.

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.

Article C2866 - December 9, 2006 « »

Leo Leo A. Notenboom has been playing with computers since he was required to take a programming class in 1976. An 18 year career as a programmer at Microsoft soon followed. After "retiring" in 2001, Leo started Ask Leo! in 2003 as a place for answers to common computer and technical questions. More about Leo.

Not what you needed?

December 9, 2006 8:24 PM


December 15, 2006 6:42 PM

I defrag every week, and over time, the "blue sections" become more coherent. I do it after I run all my spyware programs, and re-arrange files. Usually on a lazy Sunday afternoon when the Lions are on (and I can take a nap!) LOL

December 15, 2006 10:40 PM

Whose Lions are they please?..What are they ON?
etc..Here in the UK we never see lions except in the Zoos..

December 16, 2006 7:00 AM

When you really get fed up with defragging (which doesn't take long with a big drive) pop over to
and blow $13 on Magical Defrag. Does it while your computer is idle. No noticeable effect on other tasks. Bonus: once you buy a product and get on their list you'll get offers for their other products (which I think are exceptionally good) at reduced prices. So don't buy everything the first time you visit.

December 16, 2006 10:40 AM

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

December 16, 2006 2:13 PM

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).

Ivan Tadej
December 21, 2006 5:04 PM

Personally I use the FREE "Contig": 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: program from DirMS site (here's also a link to its page at ); 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, 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": , 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

C. Baker III
December 27, 2006 11:30 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.

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

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.

December 28, 2006 7:21 PM

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...

September 25, 2008 6:19 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.


December 27, 2008 4:36 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 (

October 27, 2009 11:48 PM

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

November 20, 2009 9:12 AM

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

Defragging is defragging whether you're in the OS or not. Chances are a few additional files will successfully defrag if you're not running the operating system at the time.

Michael Perrenoud
May 13, 2011 2:48 PM

Check out my video that will walk you through defragmenting your computer, it's short, simple, and to the point!

Comments on this entry are closed.

If you have a question, start by using the search box up at the top of the page - there's a very good chance that your question has already been answered on Ask Leo!.

If you don't find your answer, head out to to ask your question.