Fragmented and Defragmented Data
We have already discussed that each file in the disk is stored as a linked list of clusters by which the data that is contained in a file and can be located anywhere on the disk. If you have a 10 MB file stored on a disk using 4,096-byte clusters, it is using 2,560 clusters. These clusters can be on different tracks, different platters of the disk, in fact, they can be anywhere.
Though a file can be spread all over the disk, this is far from the preferred situation. The reason is the undesirable slow performance. Hard disks are relatively slow devices, mainly because they have mechanical parts in them. Each time the hard disk has to move the heads to a different track, it takes time that is equivalent to thousands and thousands of processor cycles.
Therefore, we want to minimize the degree to which each file is spread around the disk. In the ideal case, every file would in fact be completely contiguous. That means each cluster it uses would be located one after the other on the disk. This would enable the entire file to be read, if necessary, without a lot of mechanical movement by the hard disk.
Actually, the file system starts out with all or most of its file contiguous but as a result of the creation and deletion of files over a period of time the data on the disk becomes more and more fragmented.
Let us consider a simple example to understand the fragmentation. The table below represents the usage of the 12 clusters. Initially, the table is empty: