File system fragmentation: Difference between revisions

Content deleted Content added
note about free space
Line 2:
 
==Why fragmentation occurs==
Initially, when a file system is initialized on a partition (the partition is formatted for the file system), the entire space alotted is empty.<ref>The partition is not ''completely empty'': some internal file system structures are always created. However, these are typically contiguous, and their existence is negligible. Some file systems, such as [[NTFS]] and [[ext2]]+, might also preallocate empty contiguous regions for special purposes.</ref> This means that the allocator algorithm is completely free to position newly created files anywhere on the disk. For some time after creation, files on the file system can be laid out near-optimally. When the [[operating system]] and [[application software|application]]s are installed, or other [[archive (computing)|archive]]s are unpacked, laying out separate files sequentially also means that related files are likely to be positioned close to each other.
 
However, as existing files are deleted or truncated, new regions of free space are created. When existing files are appended to, it is often impossible to resume the write exactly where the file used to end, as another file may already be allocated there &mdash; thus, a new fragment has to be allocated. As time goes on, and the same factors are continuously present, free space as well as frequently appended files tend to fragment more. Shorter regions of free space also mean that the allocator is no longer able to allocate new files contiguously, and has to break them into fragments. This is especially true when the file system is more full &mdash; longer contiguous regions of free space are less likely to occur.
 
To summarize, factors that typically cause or facilitate fragmentation, include: