Technology in terms you understand. Sign up for the Confident Computing newsletter for weekly solutions to make your life easier. Click here and get The Ask Leo! Guide to Staying Safe on the Internet — FREE Edition as my thank you for subscribing!

How do I defragment my new hard disk?

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.

Become a Patron of Ask Leo! and go ad-free!

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.

Subscribe to Confident Computing! Tech problem solving & safety tips & a weekly confidence boost in your inbox every week.

I'll see you there!

10 Reasons Your Computer is Slow

Slow Computer?

Speed up with my special report: 10 Reasons Your Computer is Slow, now updated for Windows 10.

NOW: name your own price! You decide how much to pay -- and yes, that means you can get this report completely free if you so choose. Get your copy now!

15 comments on “How do I defragment my new hard disk?”

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

    Reply
  2. When you really get fed up with defragging (which doesn’t take long with a big drive) pop over to
    http://www.ashampoo.com/
    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.

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

    Reply
  4. 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/

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

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

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

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

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

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

    Leo
    21-Nov-2009

    Reply

Leave a reply:

Before commenting please:

  • Read the article.
  • Comment on the article.
  • No personal information.
  • No spam.

Comments violating those rules will be removed. Comments that don't add value will be removed, including off-topic or content-free comments, or comments that look even a little bit like spam. All comments containing links and certain keywords will be moderated before publication.

I want comments to be valuable for everyone, including those who come later and take the time to read.