The Importance of Disk DefragmentationBy Lawrence Abrams on April 14, 2004 | Last Updated: April 21, 2012 | Read 165,980 times.
Table of Contents
I am sure many of you have been told in the past to defrag your hard drives when you have noticed a slow down on your computer. You may have followed the advice and defragged your hard drive, and actually noticed a difference. Have you ever wondered why defragging helps though? This tutorial will discuss what Disk Fragmentation is and how you can optimize your hard drive's partitions by defragmenting them for better performance.
In order to understand why defragging works, it is important to understand how data is stored on your hard drive. When data, such as a file, is stored on a hard drive the operating system attempts to store that file in one section of contiguous, locations that are connecting without a break, space. When you have a new hard drive, storing data in contiguous spaces is not a problem. As you use the hard drive, though, files will be deleted from it and small pockets of space will be created on your hard drive. These small pockets of space on your hard drive is called fragmentation.
When a hard drive is fragmented, and the operating system wants to store a file on the hard drive, it attempts to store it in a section of contiguous space that will be large enough to accommodate the file. If the hard drive is heavily fragmented, there is the possibility that there will not be enough contiguous space available to store the file, and therefore the file will be broken up and stored in multiple locations on the hard drive. This causes the file to become fragmented. This is especially bad when installing new software on your computer because the program will now be installed over multiple locations on your hard drive. Now when you run this particular application its performance will be degraded because it has to be loaded from multiple locations on the hard drive.
Figure 1 below shows an example of a fragmented file. Notice how File1 is stored in two locations which are not contiguous.
Figure 1: Fragmented File
To solve this problem, software developers developed a type of program called a Disk Defragmenter. A defragmenter is an application that reorganizes the data on your hard drive's partitions in such a manner that the files are stored in as much contiguous space as possible. The defragmenter will search your hard drive partition and move data from one location to another location, so that the files stored there are one contiguous piece, instead of being spread throughout multiple locations on the hard drive's partition. This allows the programs and data to run more efficiently and quickly as the operating system does not have to read from multiple locations.
Figure 2 below shows an example of a file store in contiguous space. Notice how the entire file is located in one area and not split between multiple locations.
Figure 2: File that is not fragmented
There are two ways to defragment your hard drive. One way is to use a Disk Defragmenter program and the other is to use an extra empty hard drive. We will discuss both ways below.
Please Note that this tutorial will cover the defragmenter found in Windows XP only. The other versions of windows, and other vendor's applications, have similar programs that should not be too hard to figure out when following this tutorial.
Step 1: Shut down all applications
It is a good procedure to shut down all applications before you run a Disk Defragmenter including your Antivirus software. This is to make sure that no programs attempt to write to the drive while it is being defragmented. Though this will not cause any damage, it may cause you to have to restart the entire process from the beginning.
Step 2: Running the Disk Defragmenter
Windows comes with a program called Disk Defragmenter which is installed with the operating system. This program can be found in your System Tools folder under Accessories on your Programs menu. This is shown in Figure 3 below.
Figure 3. Launching Disk Defragmenter
Figure 4. Disk Defragmenter Startup Screen
Step 3: Analyze your partitions
When you click on the Analyze button, designated by the red box in Figure 4, the Defragmenter will scan the partition you have selected and give you a report on how badly it is fragmented. The higher percentage that you are fragmented, the worse it is. When it is done analyzing your hard drive it will give you a prompt that tells you the recommendation on whether you should defragment or not and gives you the option to defragment or view the report as show in Figure 3 below.
Figure 5. Prompt to view Report or Defragment
Figure 6. Report of Analysis
Step 4: Defragmenting
NOTES: Before defragging will occur the following rules apply:
As you can see from Figure 6 above, this computer has a total fragmentation of 34%. That is not good and my computer is not giving me the performance that it should be. I am therefore going to defragment my hard drive by clicking on the Defragment button, designated by the blue box in Figure 6 above. After clicking on the Defragment button you will see a window similar to Figure 7 below.
Figure 7: Defragging
The top bar, labeled"Estimated disk usage before defragmentation" is the Analysis display and shows a graphical representation of your partition before the defrag started.
The bar under it, labeled"Estimated disk usage after defragmentation" is the Defragmentation display. This shows a real-time graphical representation of your partition while it it going through defragmentation.
The colors on the displays, with they key designated by the blue box in Figure 7, represent the state of the different sections of the partition. The colors mean the following:
You should let the hard drive defrag your partition, which can take many hours so you may want to do something else for a while. When it is completed, it will give you a summary report and then you can shut the program or defrag any other partitions that you may have. When you are completed your hard drive partition should now be defragmented.
In general disk fragmentation is not as much of a problem for Linux or Macintosh based computers.
Most Linux computers use the ext2 or ext3 file system which is known to be resilient against fragmentation and is not as severely affected when it does occur. It is advised that you do not manually defragment these types of file systems.
Macintosh based computers do not require defragmentation as much either. Apple actually recommends you do not defrag your drives if you are using MAC OSX as there will be little benefit. They even state that defragging has the chance of causing a loss of performance.
If you would still like to use a tool that works on an Apple hard drive, the a program that is highly recommended is:
Please note that many people have reported that Norton Utilities for Mac can actually cause problems when using their Disk Defrag utility, so it is advised that you do not use that program for these purposes.
Probably the best way to defragment your hard drive, if it is in your budget, is to use a spare hard drive. In order to defrag you would copy all the data off the heavily fragmented drive onto a clean spare drive. You would then delete all data on the fragmented drive, and then restore that data back from the spare drive. This will then copy all the data back to the drive in a clean contiguous manner.
This method will work for any operating system.
There really is no way to prevent fragmentation as it is a natural process that occurs when writing and deleting data to a hard drive. Some file systems are more resilient to Disk Fragmentation such as NTFS and EX2. If you are a Windows user and are not dual-booting operating systems that are not compatible with NTFS then you should upgrade your file systems to NTFS. Not only will you gain the benefit of a more intelligent file system but you will gain added security benefits as well.
As you can see disk fragmentation can cause varying degrees of problems depending on the operating system you use. If you are a Windows user, then it is advised that you defragment, if you are a Linux or Mac user then it is said to not be as important. If you do choose to defragment your hard drives, the list of tools below can be used for the various operating systems:
Recommended Windows Defragmenter's:
Recommended Macintosh Programs:
As always if you have any comments, questions or suggestions about this tutorial please do not hesitate to tell us in the computer help forums.
Comments:blog comments powered by Disqus
|Tech Support Forums | The Computer Glossary | RSS Feeds | Startups | The File Database | Virus Removal Guides | Downloads|