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.
In the resulting command prompt, type defrag e: where "e:" is the drive you want to defragment. The result should look something like this:
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:
Click on Disk Defragmenter, and (perhaps after resizing the window so that all drives show) you'll see something much like this:
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:
an empty drive is, by definition, "defragmented"
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.