What is defragmenting?
When you create or copy new files on your hard disk, Windows creates these files one after another on the hard disk wherever the space is available. Sometimes, a file has to be written in fragments in many places as the space is available on the hard disk. When system has to read such a fragmented file, it would take time for hard disk to spin and spindle to move at all those fragments’ location on hard disk; thus making Windows slower to respond.
To understand this, imagine a group of friends who go to watch a play in a theater. The usher says the seats are available but not at the same place and he makes them sit in different rows, away from each other. Now we would say the group of friends are fragmented. If you had to ask a question from that group of friends, what arrangement do you think would be faster – all of them sitting in consecutive seats or they all sitting scattered in different positions away from each other?
In the defragmenting process, Windows brings all the fragments of a file close together, which were scattered in different positions on a hard disk, so that disk access to read and modify files becomes quicker; thus making Windows respond faster.
Defragmenting using Windows Disk Defragmenter
Windows XP has a disk defragmenter tool which you can use to defragment your hard disks. To access Windows Disk Defragmenter, go to Start Menu → Programs → Accessaries → System Tools → Disk Defragmenter if you are using Classic Start Menu. If you are using new Start Menu then you can open Windows Disk Defragmenter from Start Menu → All Programs → Accessaries → System Tools → Disk Defragmenter. You can also open Windows Disk Defragmenter from Start Menu → Run, typing dfrg.msc and pressing Enter.
Select a partition by clicking on it and then click on Analyze button to analyze it. This analyzes whether the partition needs to be defragmented or not. If it needs to be defragmented, Disk Defragmenter would suggest you to proceed with defragmentation, as shown in the following picture:
You can proceed with defragmentation by clicking on Defragment button. The Windows Defragmenter would start defragmenting the selected partition. This process may take few minutes to few hours depending on the hard disk size, hard disk speed, system speed and system load etc.
You can pause the defragmentation by clicking on Pause button. You can also stop the defragmentation by clicking on the Stop button. Once the defragmentation is done, it will show a message like the one shown in the picture below :
Using command line Defrag tool
You can defrag using a command like deframentation tool as well. Open a command prompt Window, from Start Menu → Run, typing cmd and pressing Enter. In the command prompt Window, type defrag -a C: to analyze partition C: if it needs some defragmenting or not. You can do this to all partitions.
If a partition needs defragmenting, you can type defrag C: to defrag C: partition. In the following image, I have used the command line defrag tool to defragment the D: partition :