Search code examples
memory-managementoperating-systemcomputer-sciencefragmentationfat

Doesn't fragmentation in FAT file system lead to space wastage?


The wikipedia for article for fragmentation states:

In many cases, fragmentation leads to storage space being "wasted", and in that case the term also refers to the wasted space itself. For other systems (e.g. the FAT file system) the space used to store given data (e.g. files) is the same regardless of the degree of fragmentation (from none to extreme).

Does that mean no storage space is wasted in case of FAT file system? If so, how is to so?


Solution

  • Most "non-traditional Unix" and FAT file systems I am aware of use an allocation bitmap to identify free space on the disk and some form of file extent descriptors. A separate descriptor is required for each contiguous region for the file. If a file is entire contiguous, it needs only one extent descriptor.

    In FAT, the file allocation table performs the function of the bitmap and descriptors in one. Instead of being an array of bits indicating allocation, it is an array containing values (size depends on the FAT variant) indicating the usage (e.g., the file's next cluster, bad disk cluster) of the corresponding disk cluster.

    In FAT, there is always one n-Bit entry for each cluster used by the file. That is why the file overhead is the same no matter the file size.

    In bitmap systems, the amount of overhead can be less than on FAT.

    Does that mean no storage space is wasted in case of FAT file system? If so, how is to so?

    That depends on your perspective. One could say that FAT always wastes space.

    I think you would find that FAT is simple to implement but tends to have relatively poor performance.