Disk Structure: Understanding Physical Storage
Tracks and Sectors
Read aloud is unavailable in this browser.
The Fundamental Units of Disk Storage
Every byte stored on a hard disk resides within a precisely defined physical location. The recording surface is organized into a hierarchical structure of tracks and sectors that enables the drive to locate any piece of data among billions of storage locations.
Why These Concepts Matter for Databases:
Database systems do not read or write individual bytes to disk. Instead, they work with pages (typically 4KB, 8KB, or 16KB blocks) that directly correspond to disk sectors or groups of sectors. Understanding track and sector organization reveals:
- Why database page sizes are what they are
- How sequential vs. random access patterns affect performance
- Why Zone Bit Recording changes performance characteristics across the disk
- How the physical layout influences data organization strategies
This knowledge enables database administrators and developers to make informed decisions about data layout, table partitioning, and storage configuration.
By the end of this page, you will understand track and sector organization, the sector format including headers and error correction, Zone Bit Recording and its implications, sector size evolution from 512 bytes to 4K Advanced Format, and how these physical characteristics affect database design decisions.
Track Organization
A track is a single concentric circle on a recording surface that stores data as a continuous sequence of magnetic transitions. All data at a given radius from the spindle center lies on the same track.
Track Characteristics:
- Concentric Organization — Tracks form concentric circles around the spindle
- Track Number — Each track has a unique identifier (0 to N-1, from outer to inner or vice versa)
- Track Width — The physical width of the recorded area (typically 50-100 nanometers in modern drives)
- Guard Band — Unused space between adjacent tracks to prevent interference
- Track Density — Measured in Tracks Per Inch (TPI); modern drives exceed 500,000 TPI
Outer vs Inner Tracks:
Due to the circular geometry of the platter:
- Outer tracks have a larger circumference than inner tracks
- At constant rotation speed, outer tracks sweep more media past the head
- Early drives wasted this capacity by storing the same number of sectors regardless of track location
- Modern drives use Zone Bit Recording (ZBR) to capitalize on this geometry
| Parameter | Typical Value | Trend |
|---|---|---|
| Track Pitch | 40-100 nm | Decreasing (higher density) |
| Track Width | 30-80 nm | Decreasing (higher density) |
| Guard Band Width | 10-30 nm | Decreasing |
| Tracks per Inch (TPI) | 400,000-600,000 | Increasing |
| Tracks per Surface | 300,000-600,000 | Increasing with density |
| Bits per Inch (BPI) | 1-2 million | Increasing |
Track Density Challenges:
As track density increases, several engineering challenges emerge:
- Adjacent Track Interference (ATI) — Writes to one track can disturb adjacent tracks; requires reading nearby tracks to verify/restore
- Head Positioning Precision — Narrower tracks require more precise servo systems
- Signal-to-Noise Ratio — Narrower tracks produce weaker signals
- Thermal Stability — Smaller magnetic grains are more susceptible to thermal fluctuation (superparamagnetic limit)
Shingle Magnetic Recording (SMR) addresses some density limits by allowing tracks to overlap, but this introduces write complexity.
There is a fundamental physical limit to magnetic storage density. Below a certain magnetic grain size (~10 nm), thermal energy at room temperature is sufficient to randomly flip magnetic domains, causing data loss. This 'superparamagnetic limit' drives research into technologies like Heat-Assisted Magnetic Recording (HAMR) and Microwave-Assisted Magnetic Recording (MAMR) to overcome current density barriers.
Sector Organization
A sector is the smallest addressable unit of storage on a hard disk. Each sector contains a fixed amount of user data along with additional overhead for identification and error detection/correction.
Sector as the Atomic Unit:
- All read and write operations occur at sector granularity
- You cannot read or write a single byte—the entire sector is transferred
- Sector size is fundamental to storage system design
Standard Sector Sizes:
- 512 bytes — Legacy standard, established in 1970s
- 4096 bytes (4K) — Advanced Format, adopted starting ~2010
- 520/528 bytes — Enterprise formats with additional integrity fields
- 4160/4224 bytes — Enterprise 4K with protection fields
| Sector Size | User Data | Typical Use | ECC Efficiency |
|---|---|---|---|
| 512 bytes | 512 B | Legacy compatibility | Lower (small block ECC) |
| 512e | 512 B (emulated) | AF drives with legacy OS | Higher (native 4K internally) |
| 4096 bytes (4Kn) | 4096 B | Modern systems | Higher (larger block ECC) |
| 520 bytes | 512 B + 8 B DIF | Enterprise with T10 DIF | Additional integrity |
| 4160 bytes | 4096 B + 64 B DIF | Enterprise 4K with T10 DIF | Highest integrity |
Sectors on a Track:
Each track is divided into sectors arranged in sequence around the circumference:
- Sector Numbering — Sectors are numbered 0, 1, 2... within each track
- Sector Count Variation — Due to ZBR, outer tracks have more sectors than inner tracks
- Sector Interleave — Historical technique (now obsolete) where logical sector numbers were not physically sequential
- Physical Sector Gaps — Small gaps between sectors for timing and synchronization
Sector Distribution Example:
A modern 7200 RPM drive might have:
- Outer zone: 1200+ sectors per track
- Middle zones: 800-1000 sectors per track
- Inner zone: 500-600 sectors per track
Most databases use page sizes of 4KB, 8KB, or 16KB. With 4K sectors, a 16KB database page spans exactly 4 sectors. Proper alignment ensures that each database page maps to a whole number of sectors, avoiding the performance penalty of reading/writing extra sectors for misaligned pages. File systems should be formatted with 4K sector alignment for optimal performance.
Sector Format Structure
Each sector on the disk contains more than just user data. The physical sector format includes multiple fields for identification, synchronization, and error protection.
Sector Format Fields:
A typical sector contains the following sequence of fields:
- Gap — Timing margin between sectors
- Sync Mark — Pattern allowing the controller to synchronize with bit stream timing
- Address Mark / Sector ID — Identifies track and sector for verification
- Data Sync — Synchronization for data field timing
- User Data — The actual user content (512 or 4096 bytes)
- ECC (Error Correcting Code) — Reed-Solomon or LDPC parity bytes
- Trailing Gap — Margin before next sector
- •Gap: ~20-30 bytes — Provides timing margin
- •Sync Mark: ~10-15 bytes — Clock synchronization pattern
- •Sector ID: ~4-8 bytes — Cylinder, Head, Sector, Size identifiers
- •ID CRC: ~2 bytes — CRC for sector ID verification
- •Data Sync: ~10-15 bytes — Data field synchronization
- •User Data: 512 bytes — The actual data content
- •ECC: ~50-100 bytes — Error correction redundancy
- •Gap: ~10-20 bytes — Trailing margin
Format Efficiency:
The overhead fields reduce storage efficiency. For a 512-byte sector:
- Total physical sector size: ~600-650 bytes
- User data: 512 bytes
- Format efficiency: ~78-85%
For a 4096-byte sector:
- Total physical sector size: ~4200-4300 bytes
- User data: 4096 bytes
- Format efficiency: ~95-97%
This is a key advantage of larger sectors—better format efficiency.
Servo Wedges:
Interspersed with data sectors are servo wedges—prewritten patterns that the drive uses for head positioning. These servo sectors:
- Cannot be overwritten
- Consume approximately 5-10% of track capacity
- Are read continuously during operation
- Provide positioning feedback thousands of times per disk revolution
Unlike high-level formatting (file system creation), low-level format that rewrites sector headers is typically performed only at the factory. Modern drives do not support user-accessible low-level formatting. The servo patterns and sector structure are written during manufacturing with specialized equipment. Attempts at low-level formatting on modern drives are either ignored or can damage the drive.
Zone Bit Recording (ZBR)
Zone Bit Recording (ZBR) is a technique that maximizes disk capacity by storing more sectors on outer tracks than inner tracks, matching the available circumference.
The Geometry Problem:
Consider a platter rotating at constant angular velocity:
- All tracks complete one revolution in the same time
- Outer tracks have a larger circumference
- At constant linear density, outer tracks can store more data
Early Approach (Constant Angular Velocity, CAV):
- Same number of sectors on every track
- Same bit rate regardless of radius
- Simple electronics but wasted capacity on outer tracks
ZBR Approach:
- Divide the disk surface into concentric zones
- Each zone has a constant number of sectors per track
- Outer zones have more sectors per track than inner zones
- Different bit rates for different zones (faster for outer zones)
| Zone | Track Range | Sectors/Track | Data Rate |
|---|---|---|---|
| Zone 0 (Outer) | 0-20,000 | 1,200 | ~260 MB/s |
| Zone 1 | 20,001-40,000 | 1,100 | ~240 MB/s |
| Zone 2 | 40,001-60,000 | 1,000 | ~220 MB/s |
| Zone 3 | 60,001-80,000 | 900 | ~195 MB/s |
| Zone 4 | 80,001-100,000 | 800 | ~175 MB/s |
| Zone 5 (Inner) | 100,001-120,000 | 650 | ~145 MB/s |
Performance Implications of ZBR:
Because outer tracks hold more data and transfer at higher rates:
- Outer zones are faster — Both higher capacity and higher transfer rate
- Sequential reads show variable speed — Performance degrades as reading progresses from outer to inner
- The first ~30% of the disk is fastest — Benchmarks often overstate performance by measuring only the beginning
- Short-stroking — Some systems use only the outer zones for maximum performance
ZBR Capacity Gain:
ZBR increases capacity by 20-50% compared to constant sectors-per-track:
- Without ZBR: ~120,000 tracks × 700 sectors = 84 million sectors
- With ZBR: average 900 sectors/track = 108 million sectors
- Capacity increase: ~28%
For performance-critical databases on HDDs, consider 'short-stroking'—using only the outer portion of the disk. This provides 30-50% higher transfer rates and faster seek times (less distance to travel). Many enterprise storage systems automatically tier hot data to outer zones. When partitioning disks, place performance-critical partitions first (on outer zones).
Advanced Format (4K Sectors)
Advanced Format (AF) is an industry initiative that increased the standard sector size from 512 bytes to 4096 bytes (4K). This transition, formalized around 2010, has significant implications for database storage.
Why 4K Sectors?
The move to 4K sectors provides several benefits:
- Improved Format Efficiency — Fixed overhead (sync, gaps, ID) per sector is amortized over 8× more data
- Stronger Error Correction — Larger sectors allow more powerful ECC codes
- Reduced Sector Count — Fewer sectors to track and manage
- Higher Capacity — Enables continued capacity growth
Quantifying the ECC Improvement:
- 512-byte sector: Might correct 1 error in 512 bytes
- 4096-byte sector: Might correct 10+ errors in 4096 bytes
This provides substantially better protection against media defects and read errors.
| Format | Physical Sector | Logical Sector | Notes |
|---|---|---|---|
| 512n (native) | 512 bytes | 512 bytes | Legacy; rarely manufactured today |
| 512e (emulated) | 4096 bytes | 512 bytes | Most common; backward compatible |
| 4Kn (native 4K) | 4096 bytes | 4096 bytes | Modern enterprise; requires OS support |
512e Emulation:
The 512e format provides backward compatibility:
- Drive physically uses 4K sectors
- Drive firmware emulates 512-byte logical sectors
- Operations smaller than 4K require Read-Modify-Write (RMW)
Read-Modify-Write Penalty:
When writing to a 512e drive with misaligned or sub-4K writes:
- Drive reads the entire 4K physical sector
- Modifies the relevant 512-byte portion
- Writes the entire 4K sector back
This RMW operation can significantly degrade write performance—up to 50% penalty for random small writes.
Alignment Requirements:
To avoid RMW penalties:
- Partition start must be aligned to 4K boundary
- File system cluster size should be 4K or larger
- Database page size should be a multiple of 4K
- I/O requests should be aligned to 4K boundaries
Many performance problems on modern drives trace back to partition misalignment. Legacy partitioning tools may create partitions starting at sector 63 (a 512-byte-based offset), which is misaligned for 4K drives. Modern tools start partitions at sector 2048 or higher, ensuring 4K alignment. Verify alignment with tools like 'diskpart' (Windows) or 'parted' (Linux) before creating file systems for databases.
Error Detection and Correction
The Error Correcting Code (ECC) field in each sector is critical for data integrity. Modern drives use sophisticated codes that can detect and correct multiple errors per sector.
The Error Challenge:
Magnetic storage faces numerous error sources:
- Thermal noise — Random fluctuations in read signal
- Media defects — Physical imperfections in the magnetic layer
- Adjacent track interference — Writes to nearby tracks disturbing data
- Signal degradation — Gradual weakening of magnetic patterns over time
- Read head variations — Sensitivity changes during operation
Without ECC, raw bit error rates would be approximately 1 error per 10⁴ to 10⁶ bits read.
ECC Coding Schemes:
- •Reed-Solomon (RS) — Traditional block code; corrects burst errors; used in older drives
- •Low-Density Parity-Check (LDPC) — Modern iterative code; near-Shannon-limit performance; dominant today
- •Turbo Codes — Another iterative approach; less common in storage
- •BCH Codes — Used in SSDs; related to Reed-Solomon
LDPC Performance:
Modern LDPC codes in hard drives can:
- Correct error rates up to 10⁻² (1 error per 100 bits) in raw signal
- Achieve corrected error rates of 10⁻¹⁵ or better (1 uncorrectable error per petabit)
- Iterate multiple times to resolve difficult errors
- Use soft decision decoding (signal strength information) for improved correction
Multiple Re-Read Strategies:
When initial decoding fails, drives employ recovery strategies:
- Simple re-read — Retry reading the same sector
- Offset re-read — Slightly adjust head position and retry
- Increased TFC — Fly head closer to surface for stronger signal
- Multiple re-reads at different offsets — Combine information from multiple attempts
- Deep recovery mode — Aggressive retries with extended timeouts
Uncorrectable Sector Handling:
When all error correction attempts fail:
- Drive reports an uncorrectable read error (URE/UBE)
- Sector may be marked in defect list
- Drive may attempt to reallocate sector from spare pool
- Error is passed to host system/database for handling
Enterprise drives specify URE rates of 1 per 10¹⁵ bits or better, while consumer drives may specify 1 per 10¹⁴ bits. At large scale, these probabilities become certainties: reading 100 TB of data (8×10¹⁴ bits) from consumer drives has a high probability of encountering at least one URE. This is why RAID array rebuild can fail—'silent' UREs discovered during rebuild corrupt the array. Enterprise workloads demand enterprise drives for this reason.
Defect Management
Manufacturing a perfect magnetic surface with billions of precisely defined sectors is impossible. Defect management is the set of techniques drives use to handle media imperfections.
Types of Defects:
- Primary defects — Detected during manufacturing; never seen by user
- Grown defects — Develop during drive lifetime; handled transparently
- Soft errors — Temporary read difficulties; resolved by retry or rewrite
- Hard errors — Permanent media damage; sector must be reallocated
Defect Lists:
Drives maintain multiple defect lists:
- P-List (Primary) — Factory-detected defects; built during manufacturing
- G-List (Grown) — Reallocated defects discovered during operation
- Background Scan List — Sectors flagged during background media scan
| Step | Action | Notes |
|---|---|---|
| Read error exceeds correction threshold | ECC flags sector as marginal or failed |
| Multiple re-read attempts | Different offsets, flying heights |
| Attempt to recover data | If recovered, proceed; if not, report error |
| Assign spare sector from reserve pool | Spare sectors located at end of zone or special area |
| Update logical-to-physical mapping | LBA now maps to new physical location |
| Write recovered data to new sector | If data unrecoverable, host must provide |
| Add original sector to G-List | Will never be used again |
Reserve Sector Pool:
Drives reserve a percentage of total capacity (typically 1-5%) as spare sectors for reallocation:
- Located at the end of each zone or in dedicated areas
- When primary sector fails, LBA is remapped to spare
- Sequential access pattern is disrupted when spares are used (seek required to access remapped sector)
S.M.A.R.T. Monitoring for Defects:
Key attributes to monitor:
- Reallocated Sector Count — Number of sectors remapped to spares; high count indicates failing media
- Current Pending Sector Count — Sectors awaiting reallocation (read failure, will attempt rewrite)
- Uncorrectable Sector Count — Failed even after exhaustive recovery attempts
- Reallocation Event Count — Number of times reallocation has occurred
When sectors are reallocated, previously sequential data may require seeks to access the remapped sectors. A heavily used drive with many reallocations will experience performance degradation even for sequential access patterns. High reallocation counts (Reallocated Sector Count > 100) typically indicate a drive that should be replaced proactively, regardless of whether it's still functional.
KEEP LEARNING
There’s more to understand.
You’re reading the introduction. Create a free account to read the complete lesson, save notes and keep track of your progress.