What is Defragmenting?
With time our system starts getting slow, DOS or Windows programs and data files take much more time to load, then most probably this could be due to a fragmentation problem.
Let us first understand this term. On a disk drive, any information is stored in clusters. When all the clusters of a file are stored in consecutive sectors then it is not fragmented but when the clusters which make a file are scattered across the disk, the file or the disk is said to be fragmented.
As it takes the read/write head longer to read the file scattered across the disk surface, a fragmented file takes longer to load compared to an unfragmented file.
This can be compared with a real-life situation: If your room is not in order, it takes you longer to find something compared to a room where everything & arranged properly.
The fragmentation occurs because whenever the operating system wants to write some information on the disk drive, it consults the FAT (File Allocation Table) to find an empty cluster. The FAT keeps a record of used, available, and bad (un-usable) areas on the disk surface.
After finding an empty cluster, the operating system writes to that area and updates the FAT. If the complete file could not be written in one contiguous empty area, then the operating system looks for other areas where the rest of the file can be written. The FAT keeps a record of this chain of clusters taken up by the file. When a file is removed from the disk, the FAT is again updated to show the cluster taken up by the file as an empty area Defragmenting.
After some time, this removing file and writing of new information produce a lot of holes, i.e. empty areas in between the data a, thus the files scattering across the disk surface is known as disk fragmentation.
File fragmentation increases access time and decreases the chances of salvagitg a file when there is a problem. The disk defragmenter utility reads and rewrites the files on the disk to reorder them so that each file is once again stored contiguously on the disk surface and can be read much more efficiently by the hard disk drive.
The first part of the Figure shows a file fragmented across the disk surface and the second part shows the same file after it has been defragmented.
Because the defragmentation software moves the information stored on the disk surface, it is always better to take a backup of the information on the disk surface before using this software. This software are fully tested and the chances of data corruption are very remote, but a power loss during defragmentation or some other unexpected event may corrupt the data, so it is always better to have a current backup of all important information on the drive before using these programs.
Depending on the frequency of creating/editing/deleting the files on the hard disk drive, you can defragment the drive once a week or once a month to keep the files in one place.
Defragmenting a drive also increases the drive’s life as the read/write head will require to move less to get to the data on a properly defragmented drive. Another advantage is if the files are stored contiguously, it is easier to restore them in case of accidental deletion. Files that are scattered make it impossible to restore them.