Disk Management in Operating Systems
Disk Management in Operating Systems
Operating Systems
Introduction
Disk management is a vital function of operating systems, ensuring efficient storage,
retrieval, and organization of data on disk drives. It involves optimizing disk performance,
structuring disk space, and enhancing reliability through redundancy. This lecture note
explores three key aspects of disk management: Disk Scheduling Algorithms (e.g., FCFS,
SSTF), Disk Partitioning and Formatting, and RAID Levels. These concepts are essential
for understanding how operating systems manage disk resources to meet performance and
reliability demands.
Concept: Services disk requests in the order they arrive, following a simple queue-
based approach.
Operation:
o The disk head processes each request sequentially based on submission time.
o No optimization for head movement; it moves to the requested track
regardless of position.
Advantages:
o Simple to implement and inherently fair.
o No starvation, as all requests are eventually serviced.
Disadvantages:
o High average seek time due to random head movement.
o Inefficient for systems with heavy I/O workloads.
Example: Requests at tracks 53, 98, 183, 37 with the head at 50 result in a total seek
of |50-53| + |53-98| + |98-183| + |183-37| = 3 + 45 + 85 + 146 = 279.
Concept: Selects the request closest to the current disk head position to minimize
seek time.
Operation:
o From the current head position, the algorithm picks the nearest track in the
request queue.
o Continuously updates based on the new head position after each service.
Advantages:
o Reduces average seek time compared to FCFS.
o Improves disk performance for moderate workloads.
Disadvantages:
o Can cause starvation for requests far from the current head position.
o Not globally optimal, as it prioritizes local efficiency.
Example: Head at 50 with requests at 53, 98, 183, 37:
o Order: 50 → 53 → 37 → 98 → 183.
o Total seek: |50-53| + |53-37| + |37-98| + |98-183| = 3 + 16 + 61 + 85 = 165.
SCAN (Elevator): Moves the head in one direction, servicing requests until the end,
then reverses.
C-SCAN: Moves in one direction only, returning to the start after reaching the end,
providing uniform wait times.
LOOK: Similar to SCAN but reverses at the last request, not the disk edge.
1.4 Considerations
HDDs: Algorithms like SSTF and SCAN optimize for mechanical seek and rotational
latency.
SSDs: Scheduling is less critical due to uniform access times; simple algorithms like
NOOP suffice.
Metrics: Seek time, throughput, and fairness guide algorithm choice.
Concept: Divides a physical disk into multiple logical partitions, each treated as an
independent storage unit.
Types:
o Primary Partitions: Bootable partitions (e.g., containing an OS), limited to
four per disk in traditional MBR schemes.
o Extended Partitions: Contain logical partitions, bypassing the four-partition
limit.
o Logical Partitions: Subdivisions within an extended partition.
Partition Tables:
o MBR (Master Boot Record): Legacy scheme supporting up to 2 TB disks
and four primary partitions.
o GPT (GUID Partition Table): Modern standard supporting larger disks (up
to 9.4 ZB) and more partitions (up to 128).
Process:
o Use tools like fdisk, parted, or Disk Management (Windows) to define
partition boundaries.
o Assign partition types (e.g., NTFS, ext4) and sizes.
Advantages:
o Isolates data (e.g., OS vs. user files).
o Supports multiple OSes on one disk (dual-boot).
o Enhances manageability and backup strategies.
Disadvantages:
o Fixed sizes can lead to wasted space if misallocated.
o Adds complexity to disk management.
Concept: Initializes a partition with a file system, creating structures for data storage
and retrieval.
Types:
o Low-Level Formatting: Performed by manufacturers, defines physical
sectors and tracks (rarely user-managed).
o High-Level Formatting: Creates file system metadata (e.g., FAT, inode
tables) and prepares the partition for use.
File Systems:
o FAT32: Simple, widely compatible, limited to 4 GB files and 8 TB partitions.
o NTFS: Supports large files, encryption, and permissions (Windows standard).
o ext4: Robust, journaled file system for Linux with large partition support.
Process:
o Select a file system (e.g., mkfs.ext4 on Linux, format on Windows).
o Write file system metadata (e.g., superblock, directory tables).
o Verify the partition is ready for data storage.
Advantages:
o Enables OS-specific features (e.g., journaling, compression).
o Prepares disk for efficient data organization.
Disadvantages:
o Erases existing data during formatting.
o File system choice affects compatibility and performance.
3. RAID Levels
RAID (Redundant Array of Independent Disks) is a disk management technique that
combines multiple disks to improve performance, reliability, or both through redundancy and
striping.
Concept: Data is duplicated across multiple disks for redundancy, with no striping.
Operation: Identical copies of data are written to each disk simultaneously.
Advantages:
o High reliability; data survives single disk failure.
o Simple to implement.
Disadvantages:
o Only 50% capacity utilization (e.g., 2 TB across two 2 TB disks).
o No performance gain for writes.
Minimum Disks: 2.
Use Case: Critical systems (e.g., database servers) requiring data redundancy.
Concept: Combines striping for performance with distributed parity for redundancy.
Operation:
o Data and parity (error-checking info) are striped across all disks.
o Parity allows reconstruction of data if one disk fails.
Advantages:
o Balances performance and reliability.
o Capacity = (n-1) × disk size (e.g., 3 disks of 1 TB = 2 TB usable).
Disadvantages:
o Slower writes due to parity calculation.
o Recovery after failure is complex and time-consuming.
Minimum Disks: 3.
Use Case: File servers needing both speed and fault tolerance.
3.6 Implementation
Conclusion
Disk management is crucial for optimizing storage performance, organization, and reliability
in operating systems. Disk Scheduling Algorithms like FCFS and SSTF enhance I/O
efficiency by minimizing seek times on HDDs. Disk Partitioning and Formatting structure
disks into usable partitions with appropriate file systems, supporting diverse OS and
application needs. RAID Levels provide options for balancing performance and redundancy,
catering to everything from high-speed workloads to fault-tolerant systems. Understanding
these concepts is key to managing disk resources effectively in modern computing
environments. Future topics may include SSD optimization, disk caching, and advanced
RAID configurations.