Operating Systems · UGC NET: Storage Management Extras
Mass Storage Structure and RAID
Overview
Mass storage is the non-volatile secondary storage of a computer: magnetic hard disks, solid-state drives, optical media and magnetic tape.
The operating system must know how these devices are physically organised, how they are formatted, how they are booted from, how swap space is managed, and how multiple disks can be combined for speed and reliability.
RAID is the standard technique for combining disks using striping, mirroring and parity. This lesson covers the definitions, formulas, RAID levels and recovery ideas that UGC NET repeatedly tests.
Key concepts
- Mass storage is secondary storage that keeps data without power. Exam examples: magnetic disk, SSD, optical disk, magnetic tape.
- A platter is a circular magnetic surface; a surface has a read/write head. A track is one concentric circle on a surface; a sector is a fixed-size hardware unit on a track; a cylinder is the set of tracks with the same track number on all surfaces, accessible by switching heads without moving the arm.
- Typical UGC convention: sector size = 512 bytes unless another size is stated. Modern disks may use 4 KiB sectors; state the convention in a question.
- Cylinder = tracks per surface numerically. If there are double-sided platters, there are surfaces and read/write heads.
- Low-level formatting or physical formatting divides a disk into sectors and writes sector headers/trailers, sector numbers and error-correcting code. It is usually done at manufacture.
It does not create files or directories. - High-level formatting or logical formatting creates a file system on a partition: boot block, free-space map, root directory and metadata. It follows partitioning and low-level formatting.
- A boot block is a reserved area containing a small program that starts the boot process. Firmware loads the MBR/boot sector, then the boot loader, then the OS kernel. A bootable disk must have a valid boot block.
- Swap-space management reserves disk space for pages evicted from main memory. It can use a dedicated raw partition or a swap file. It tracks free swap slots with a swap map or bitmap.
Swap space extends effective memory; it is not the same as virtual memory itself. - RAID means Redundant Array of Independent Disks; older expansion is “Inexpensive”. Goals: performance through striping, reliability through redundancy, and capacity aggregation.
- Striping splits data across disks. Mirroring keeps duplicate copies. Parity uses XOR to recover one failed disk in RAID 3, 4 and 5; RAID 6 uses two independent parity blocks.
- RAID 0: block-level striping, no redundancy, no parity. Usable capacity ; no fault tolerance.
- RAID 1: mirroring; duplicate data on separate disks. Usable capacity is half of total raw capacity for paired disks; tolerates one disk failure per mirror pair.
- RAID 2: bit-level striping with Hamming-code error-correcting parity, not simple XOR parity. Rarely used.
- RAID 3: bit-interleaved striping with a dedicated parity disk. Good for large sequential transfers; tolerates one disk failure.
- RAID 4: block-interleaved striping with a dedicated parity disk. Independent reads are possible, but the parity disk becomes a write bottleneck.
- RAID 5: block-interleaved striping with distributed parity. Usable capacity ; tolerates one disk failure; removes the dedicated parity-disk bottleneck.
- RAID 6: block-level striping with two independent parity calculations (often P and Q). Usable capacity ; tolerates two simultaneous disk failures.
- RAID 10 or RAID 1+0: a stripe of mirrors; data is mirrored and then striped. It gives high performance and redundancy, but it is not the same as every possible two-disk failure being tolerated.
- Degraded mode: a RAID array running with a failed disk but still serving data. Rebuild means reconstructing the failed disk’s data onto a replacement disk using parity and surviving disks.
- Seek time is not strictly proportional to seek distance because the disk arm must accelerate, decelerate and settle; this is arm starting/stopping inertia.
- A block is a logical unit; a sector is a hardware unit. A block size need not be a power of two; it is an OS/file-system choice, so a value such as 51200 bytes is not inherently invalid.
How it works
- Disk read/write operation. The OS converts a logical block number into a cylinder, track, surface and sector.
The arm seeks to the correct cylinder, the head is selected, rotational latency waits for the desired sector, and data is transferred. - Low-level formatting. The disk is divided into concentric tracks and sectors. Each sector gets a header with address information and a trailer with error-correcting code. Bad sectors are marked.
This is the physical layout step. - Partitioning and high-level formatting. The disk is divided into partitions or volumes.
Each partition is high-level formatted: the OS writes a boot block where needed, file-system metadata, free-space bitmap or list, and the root directory. - Booting from a boot block. Firmware runs POST, reads the boot sector/MBR, executes the first-stage loader, then the second-stage boot loader loads the kernel.
The boot block is small and fixed-location; it is not a normal user file. - Swap-space management. When memory is overcommitted, the page replacement policy chooses victim pages. Dirty pages are written to swap slots; clean pages may be dropped. A swap map records free and used slots.
On a page fault, the page is read back from swap if needed. - RAID write and parity update. In RAID 3/4/5, parity is the XOR of corresponding data blocks. If one data block changes, the controller updates the data block and recomputes or updates parity.
If a disk fails, the lost block is reconstructed by XORing the surviving data blocks and the parity block. - RAID 5 recovery order. Detect the failed disk; replace it or activate a hot spare; rebuild the missing blocks from surviving data and parity; write reconstructed data to the new disk; verify the array and return it to normal operation.
Drawing the diagram…
Formulas
-
Use bytes unless a question states decimal units.
-
Disk capacity: , where = number of surfaces, = tracks per surface, = sectors per track, = bytes per sector. For double-sided platters, . Also, number of cylinders .
-
Track capacity: .
-
Surface capacity: .
-
Rotation time: seconds, where is revolutions per minute.
-
Maximum rotational delay: ; average rotational latency: .
-
Transfer rate for one track per revolution: bytes per second.
-
Transfer time for block size : .
-
Average disk access time: .
-
RAID 0 usable capacity: .
-
RAID 1 usable capacity: for paired disks.
-
RAID 5 usable capacity: .
-
RAID 6 usable capacity: .
-
RAID 10 usable capacity with disks in mirror pairs: .
Worked examples
Example 1: RAID capacity. A RAID 5 array has 5 equal disks of 2 TB each. Usable capacity TB. Raw capacity is 10 TB, so parity overhead is 2 TB. A RAID 1 mirror has two 3 TB disks. Usable capacity is TB; the other 3 TB is the duplicate copy.
Example 2: Disk geometry. A disk has 5 double-sided platters, 2000 tracks per surface, 50 sectors per track and 512 bytes per sector. Surfaces . Capacity bytes K using .
Track capacity bytes K. Surface capacity bytes K. Cylinders .
Example 3: Rotational delay and transfer rate. A disk rotates at 5400 rpm. Revolutions per second . Rotation time s s approximately ms. Maximum rotational delay is one full rotation, about s.
Average rotational latency is half, about s. If track capacity is 25,600 bytes, transfer rate bytes/s KiB/s.
Example 4: Disk read time. A disk has 16,384 bytes per track, rotation time 16 ms and average seek time 40 ms. Read a 1024-byte block. Average rotational latency ms. Transfer time ms. Total time ms.
Example 5: Statement type. Statement I: RAID 3 uses bit-interleaved striping with a dedicated parity disk. Statement II: RAID 4 distributes parity across all member disks. Statement I is true.
Statement II is false because RAID 4 uses a dedicated parity disk; RAID 5 distributes parity. Answer: Statement I true, Statement II false.
Comparison
| Feature | Low-level formatting | High-level formatting |
|---|---|---|
| Other name | Physical formatting | Logical formatting |
| Done by | Manufacturer/controller | OS/file system |
| Creates | Tracks, sectors, headers, ECC | Boot block, free map, root directory |
| Purpose | Make disk addressable | Make partition usable for files |
| RAID level | Striping | Redundancy | Minimum typical disks | Usable capacity | Fault tolerance |
|---|---|---|---|---|---|
| RAID 0 | Block | None | 2 | None | |
| RAID 1 | None | Mirroring | 2 | One per mirror pair | |
| RAID 2 | Bit | Hamming ECC | Depends on ECC disks | Depends | Error correction |
| RAID 3 | Bit-interleaved | Dedicated parity | 3 | One disk | |
| RAID 4 | Block-interleaved | Dedicated parity | 3 | One disk | |
| RAID 5 | Block-interleaved | Distributed parity | 3 | One disk | |
| RAID 6 | Block-interleaved | Two independent parities | 4 | Two disks | |
| RAID 10 | Stripe of mirrors | Mirroring | 4 | Usually one per mirror pair |
| Look-alike pair | Key difference |
|---|---|
| RAID 4 vs RAID 5 | RAID 4 has one dedicated parity disk; RAID 5 distributes parity across disks. |
| RAID 5 vs RAID 6 | RAID 5 tolerates one failure; RAID 6 tolerates two failures using two parities. |
| RAID 0 vs RAID 1 | RAID 0 is speed by striping with no redundancy; RAID 1 is safety by mirroring. |
| Sector vs block | Sector is hardware unit; block is OS/file-system logical unit. |
| Swap space vs virtual memory | Swap is disk backing store; virtual memory is the overall memory abstraction. |
Revision summary
- RAID 0 = zero redundancy;
RAID 1 = mirror;
RAID 2 = Hamming error-correcting;
RAID 3 = bit-interleaved parity;
RAID 4 = block dedicated parity;
RAID 5 = block distributed parity;
RAID 6 = dual parity;
RAID 10 = stripe of mirrors. - RAID 4 and 5 both tolerate one disk failure; RAID 5 removes the parity-disk write bottleneck.
- RAID 5 usable capacity is ; RAID 6 is ; RAID 1 and RAID 10 are half of raw capacity for pairs.
- Cylinder = all tracks under one arm position across all surfaces; it needs no arm movement to switch heads.
- Low-level formatting creates sectors; high-level formatting creates a file system.
- A boot block starts the boot loader; it is not the file system root directory.
- Swap space holds evicted pages on disk; it is not RAM.
- Average rotational latency = half a rotation; maximum rotational delay = one full rotation.
- Seek time is non-linear because of arm acceleration, deceleration and settling.
- Parity recovery works by XORing surviving blocks with parity to reconstruct one lost block.
- In RAID 5 recovery, replace the failed disk and rebuild from parity and surviving data.
Previous-year exam insights
- Direct RAID matching is common: RAID 2 with error-correcting parity, RAID 3 with bit-interleaved parity, RAID 4 with block-interleaved parity, RAID 5 with block-interleaved distributed parity.
- Statement I/II questions test small differences: RAID 4 dedicated parity vs RAID 5 distributed parity; RAID 5 one failure vs RAID 6 two failures; RAID 0 no redundancy.
- Numeric questions ask usable RAID capacity: use for RAID 5, for RAID 6, half total for RAID 1/10.
- Disk-geometry questions test cylinder count, track capacity and capacity formula: surfaces , cylinders , track capacity .
- Disk-performance questions test maximum rotational delay , average rotational latency , and access time seek + average rotational latency + transfer time.
- Formatting questions test low-level vs high-level formatting; do not confuse sector creation with file-system creation.
- Boot-block questions test its role in loading the bootstrap loader/kernel, not file storage.
- Swap-space questions test its purpose as disk backing store for pages, not as a replacement for virtual memory.
- A common trap is choosing RAID 4 when the question says “distributed parity”; distributed parity is RAID 5.
Another trap is treating RAID 0 as fault tolerant.
Practice at PARIKSHA
You are ready for the PARIKSHA tests of this sub-topic when you can:
- Define platter, surface, track, sector, cylinder, block and head without confusion.
- Compute disk capacity, track capacity and surface capacity from platter/track/sector data.
- Compute maximum rotational delay, average rotational latency, transfer rate and disk read time.
- Distinguish low-level formatting, high-level formatting, partitioning and boot-block loading.
- State the purpose and implementation choices of swap-space management.
- Match RAID 0, 1, 2, 3, 4, 5, 6 and 10 with their striping, parity and redundancy properties.
- Compute usable capacity for RAID 1, RAID 5, RAID 6 and RAID 10 arrays.
- Explain RAID 5 degraded-mode recovery using XOR parity and surviving disks.
- Solve Statement I/II and match-the-list questions on RAID and storage formatting.
- Identify the standard UGC traps in RAID 4 vs 5, RAID 5 vs 6, and RAID 0 vs 1.
Attempt the sub-topic test first, then the subject test.