Storage Management in OS — RAID, SSD vs HDD | Tutorials Logic
Disk Structure
A traditional Hard Disk Drive (HDD) consists of:
- Platters: Circular magnetic disks that store data
- Tracks: Concentric circles on each platter surface
- Sectors: Smallest addressable unit on a track (typically 512 bytes or 4 KB)
- Cylinders: All tracks at the same position across all platters
- Read/Write Head: Reads and writes data on the platter surface
- Spindle: Motor that spins the platters (5400, 7200, 10000, 15000 RPM)
Disk Access Time
Total disk access time = Seek Time + Rotational Latency + Transfer Time
| Component | Description | Typical Value |
|---|---|---|
| Seek Time | Time to move the read/write head to the correct track | 3-15 ms |
| Rotational Latency | Time for the desired sector to rotate under the head | 0-8 ms (avg ~4 ms at 7200 RPM) |
| Transfer Time | Time to read/write the actual data | Very small (microseconds) |
Seek time dominates - disk scheduling algorithms aim to minimize total seek time.
SSD vs HDD
| Feature | HDD | SSD |
|---|---|---|
| Technology | Magnetic platters, mechanical arm | NAND flash memory (no moving parts) |
| Speed (sequential) | 100-200 MB/s | 500 MB/s - 7 GB/s (NVMe) |
| Random access | Slow (seek time) | Very fast (microseconds) |
| Durability | Vulnerable to physical shock | More durable (no moving parts) |
| Noise | Audible (spinning, seeking) | Silent |
| Power consumption | Higher | Lower |
| Cost per GB | Lower (~$0.02/GB) | Higher (~$0.08/GB) |
| Lifespan | 3-5 years (mechanical wear) | Limited write cycles (TBW) |
RAID Levels
RAID (Redundant Array of Independent Disks) combines multiple physical disks into a logical unit for improved performance, redundancy, or both.
| RAID Level | Description | Min Disks | Fault Tolerance | Use Case |
|---|---|---|---|---|
| RAID 0 (Striping) | Data split across disks for speed. No redundancy. | 2 | None - any disk failure = total data loss | High performance, non-critical data |
| RAID 1 (Mirroring) | Exact copy of data on two disks. | 2 | 1 disk failure | OS drives, critical data |
| RAID 5 (Striping + Parity) | Data and parity striped across all disks. Parity allows recovery. | 3 | 1 disk failure | File servers, general storage |
| RAID 6 (Double Parity) | Like RAID 5 but with two parity blocks. | 4 | 2 disk failures | Large arrays, high availability |
| RAID 10 (1+0) | Mirrored pairs that are then striped. Best of RAID 1 and RAID 0. | 4 | 1 disk per mirrored pair | Databases, high I/O workloads |
Storage Hierarchy
The storage hierarchy organizes storage by speed, cost, and capacity. Faster storage is more expensive and has less capacity:
| Level | Type | Speed | Capacity | Volatile? |
|---|---|---|---|---|
| 1 | CPU Registers | ~1 ns | Bytes | Yes |
| 2 | L1/L2/L3 Cache | 1-10 ns | KB-MB | Yes |
| 3 | Main Memory (RAM) | ~100 ns | GB | Yes |
| 4 | SSD (NVMe) | ~100 �s | TB | No |
| 5 | HDD | ~10 ms | TB | No |
| 6 | Optical / Tape | Seconds | TB-PB | No |
Principle of Locality: Programs tend to access a small portion of their address space at any given time (temporal and spatial locality). This is why caching is effective - frequently accessed data is kept in faster storage levels.
Level Up Your Operating system Skills
Master Operating system with these hand-picked resources