Skip to content
We areTOP 1%

What are the contiguous, linked and indexed file allocation methods?

MediumConceptFile Systems & Disk Scheduling
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews

Answer

File allocation methods decide how a file's data blocks are placed on disk and how the file system finds them again.

  • Contiguous: the file occupies consecutive blocks, and the directory stores the start block and length. Sequential and random access are fast (block i is at start + i), but it causes external fragmentation and files are hard to grow.
  • Linked: each block holds a pointer to the next, and the directory stores the first block. There is no external fragmentation and files grow easily, but random access must follow the chain, and one damaged pointer loses the rest of the file. FAT (File Allocation Table), used on many USB drives, keeps these pointers together in one table.
  • Indexed: an index block lists all of the file's block numbers, giving fast random access without external fragmentation, at the cost of an extra block per file. Unix inodes use a multi-level indexed scheme.

Example: a three-block file.

Contiguous: blocks 10, 11, 12; the directory stores (start 10, length 3).

Linked: blocks 9 → 16 → 1 → end; the directory stores start 9.

Indexed: index block 19 contains [9, 16, 1]. To read the third block, indexed allocation reads entry 3 of block 19 and goes straight to block 1, while linked allocation must first read blocks 9 and 16 to follow the pointers.

More in File Systems & Disk Scheduling

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account