ArticleslgStudy

science

File system fragmentation

File system fragmentation is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand File system fragmentation rather than just read about it. In short: File system fragmentation, sometimes called file system aging, is a characteristic of a file system that stores files in non-contiguous blocks. It is a special case of data fragmentation.

File system fragmentation — main illustration
File system fragmentation — illustration

Key takeaways

  • File system fragmentation belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect File system fragmentation to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of File system fragmentation from memory before moving on to harder problems.

Reference excerpt

File system fragmentation, sometimes called file system aging, is a characteristic of a file system that stores files in non-contiguous blocks. It is a special case of data fragmentation. File system fragmentation negatively impacts seek time for disk storage (spinning storage medium), which lowers throughput. Fragmentation can be eliminated by re-organizing files as contiguous areas, a process called defragmentation. A solid-state drive (SSD) does not mechanically seek, so non-sequential access is orders of magnitude faster than disk drives, making fragmentation significantly less of an issue. In fact, best practice is to not defragment an SSD, because doing so can prematurely wear drives via unnecessary write and erase operations.

Causes When a file system is first initialized on a partition, it contains only a few small internal structures and is otherwise one contiguous block of empty space. This means that the file system can place newly created files anywhere on the partition. For some time after creation, files can be laid out near-optimally. When the operating system and applications are installed or archives are unpacked, separate files end up occurring sequentially so related files are positioned close to each other. 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; 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 file system is no longer able to allocate new files contiguously, and has to break them into fragments. This is especially true when the file system becomes full and large contiguous regions of free space are unavailable.

Example The following example is a simplification of an otherwise complicated subject. Consider the following scenario: A new disk has had five files, named A, B, C, D and E, saved continuously and sequentially in that order. Each file is using 10 blocks of space. (Here, the block size is unimportant.) The remainder of the disk space is one free block. Thus, additional files can be created and saved after file E. If the file B is deleted, a second region of ten blocks of free space is created, and the disk becomes fragmented. The empty space is simply left there, marked as available for later use, then used again as needed. The file system could defragment the disk immediately after a deletion, but doing so would incur a severe performance penalty at unpredictable times. Now, a new file called F, which requires seven blocks of space, can be placed into the first seven blocks of the newly freed space formerly holding the file B, and the three blocks following it will remain available. If another new file called G, which needs only three blocks, is added, it could then occupy the space after F and before C. If subsequently F needs to be expanded, since the space immediately following it is occupied, there are three options for the file system:

Adding a new block somewhere else and indicating that F has a second extent Moving files in the way of the expansion elsewhere, to allow F to remain contiguous Moving file F so it can be one contiguous file of the new, larger size The second option is probably impractical for performance reasons, as is the third when the file is very large. The third option is impossible when there is no single contiguous free space large enough to hold the new file. Thus the usual practice is simply to create an extent somewhere else and chain the new extent onto the old one. Material added to the end of file F would be part of the same extent. But if there is so much material that no room is available after the last extent, then another extent would have to be created, and so on. Eventually the file system has free segments in many places and some files may be spread over many extents. Access time for those files (or for all files) may become excessively long.

Necessity

Some early file systems were unable to fragment files. One such example was the Acorn DFS file system used on the BBC Micro. Due to its inability to fragment files, the error message can't extend would at times appear, and the user would often be unable to save a file even if the disk had adequate space for it. DFS used a very simple disk structure and files on disk were located only by their length and starting sector. This meant that all files had to exist as a continuous block of sectors and fragmentation was not possible. Using the example in the table above, the attempt to expand file F in step five would have failed on such a system with the can't extend error message. Regardless of how much free space might remain on the disk in total, it was not available to extend the data file. Standards of error handling at the time were primitive and in any case programs squeezed into the limited memory of the BBC Micro could rarely afford to waste space attempting to handle errors gracefully. Instead, the user would find themselves dumped back at the command prompt with the Can't extend message and all the data which had yet to be appended to the file would be lost. The problem could not be solved by simply checking the free space on the disk beforehand, either. While free space on the disk may exist, the size of the largest contiguous block of free space was not immediately apparent without analyzing the numbers presented by the disk catalog and so would escape the user's notice. In addition, almost all DFS users had previously used cassette file storage, which does not suffer from this error. The upgrade to a floppy disk system was an expensive upgrade, and it was a shock that the upgrade might without warning cause data loss.

Types File system fragmentation may occur on several levels:

Fragmentation within individual files Free space fragmentation The decrease of locality of reference between separate, but related files Fragmentation within the data structures or special files reserved for the file system itself

… excerpt ends here. Continue reading the full article.

Illustrations

File system fragmentation: Visualization of fragmentation and then of defragmentation
Visualization of fragmentation and then of defragmentation
File system fragmentation: Simplified example of how free space fragmentation and file fragmentation occur
Simplified example of how free space fragmentation and file fragmentation occur

Worked examples

Example 1 — a first encounter with File system fragmentation

Start with the simplest possible case. Write down what File system fragmentation claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to File system fragmentation before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about File system fragmentation ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of File system fragmentation

In research
File system fragmentation appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses File system fragmentation in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
File system fragmentation is common in secondary-school and first-year university syllabi. It links to neighbouring topics File system management, so understanding it makes those chapters shorter.
In everyday life
Look for File system fragmentation outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “File system fragmentation” →

How to study File system fragmentation in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what File system fragmentation means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain File system fragmentation out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is File system fragmentation in simple terms?

File system fragmentation, sometimes called file system aging, is a characteristic of a file system that stores files in non-contiguous blocks. It is a special case of data fragmentation.

Why does File system fragmentation matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study File system fragmentation?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on File system fragmentation.

Tags

  • File system management

Keep exploring