Hard Drives

Wikipedia topic : "hard disk drive"

Other interesting sites :

  https://ntfs.com/hard-disk-basics.htm

Hard drive features -  Winchester
  Disc(s) - 5.25", 3.5", 2.5", 1" or 1.3" and others.
    Platters

  Aluminum discs coated with magnetic material.

  Laptops and future desktop drives made with glass, 
    more rigid, lighter, thinner, more heat tolerant.
    But more brittle.
    
    Check out : https://www.extremetech.com/computing/255048-20tb-hard-drives-made-glass-substrates

  Same technology as audio and video cassette recording.
    Except cassette recording is 1 dimensional along length of media
    Disc recording is 2/3 dimensional, move along track or across tracks.
      and both sized of disc(s) hold data. 

  Magnetic media on both sides of disk or platter.
    Multiple platters (1 to 2 platters common).
    * Early IBM mainframe drive had 50 platters/100 Heads.

  Constant rotational speed 3600 (external), 7200 (most common),
    10800 (SCSI), or 15000 RPM (SCSI). Although these becoming obsolete.

    Default design allows for data to be transferred at a variable rate.
      Standard 7200 RPM HD ~ 1000Mi-bit/sec between drive and internal cache.
        ~ 133MB/sec to system via Parallel ATA ideal conditions.

        ~ practical closer to 50 MB/s because of
           fragmentation, swap (VM), shared interface, etc.

        ~ SATA can provide bursts upward of 600 MB/s if RAM cache used.
          * near limit of access speed to tracks and sectors.
          * modern drives have RAM cache/buffers to help with this.

      1TB 10K rpm SATA $314 (2016) - 64 MB cache - 6 Gb/s (750 MB/s)
      * Amazon
      2018 - most 10 K hard drives listed are refurbished.
      7200 RPM drives with 64 MB buffers preferred. 

      SSD drives can offer better transfer rate. Limit may be the SATA protocol.
         NVMe/PCIe interface - 16 GB/sec. 
 
  One or more platters. Current technology, 1.33 TB per platter (2015?).

  Set of many parallel tracks on each surface of a platter.

  Read/write head(s) for each side of each platter.
    Only one head active at any time (most designs).

  Heads make no contact with media allowing high rotational speed.
    Manufactured in a clean environment (cleaner than operating room).

    Hard drives don't work well (or at all) in space.
        check out www.dansdata.com/spacecomp.htm

    Some designs fill drive with a silicone lubricant. 
      Better shock resistance, military grade.
      For systems that travel and are needed in the field.
      * SSDs may make this obsolete as price drops.

    New designs used sealed case with helium. Allows for more platters
      with lower power draw.

Parsing of storage
  Tracks broken into sectors (512 bytes user data + sync + error check).

    

    source : wikipedia

    Because of the number of sectors on the newer drives and the overhead.

       Newer protocol uses 4096 bytes/sector called "Advanced Format"
        (only accessible with latest BIOS, file systems).

       See
         Advanced Format
           Also : www.anandtech.com/show/2888


  The set of tracks found at the same radial position on each disk surface are
    collectively called a cylinder.


  Addressed in the format
    CHS - cylinder, head, sector -- (cylinder, head) = track.

  Numbered from: cylinder 0, head 0, sector 1.

  Early drives had same number of sectors on all tracks.

  There are several logic systems/protocols that have to interact to
    track and access storage on a hard drive.
 
    System OS/filesystem.
    System BIOS (basic I/O system).
      ROM stored code.
    Drive controller.

    If the recognized size limits of CHS values aren't same,
    then the minimal intersect of each is the max recognized.

  Early design of PCs and their BIOS limited the CHS values
    Example of mid-90s available configurations. 
    Used 24 bit address parsed into c/h/s
    # sector 512 bytes or 2^9 bytes.

      BIOS  Max c = 1024, h = 255, s = 63 -=- 8GB total.
               2^10    2^8      2^6   24-bits  x 2^9 = 33  2^33 = ~8GB

    Check out : http://www.pcguide.com/ref/hdd/bios/sizeMB504-c.html

  Attempt to fix limits as drive grew.
    Logical vs. Physical geometry

      Physical geometery is the actual number of heads, tracks, and sectors
        on the drive.

      Logical geometry is the number of each of these the drive controller
        logic reports to the BIOS/OS.

        This allows the drive to claim it has more heads but fewer cylinders
        and sectors per track than it actually does. 

    Partitioning. Drive broken into separate partitions, each of which
      could have 1024 cylinders, 16 heads, and 63 sectors.

    Clusters
      - sectors were clustered together, so c/h/s listed 1st sector of cluster.
      The additional sectors were auto-read.
      # sector index became cluster index.

      Allowed larger 'drives' but a partition set up with 16K cluster
        used blocks of 16K for all files. So a 50 byte file took 16K.

      Windows offered formats with 64 sectors/cluster.

    LBA addressing. Sectors numbered sequentially.
      Drive has a table of CHS layout for whole drive surface.
      # another form of logical geometry.

      OS/BIOS no longer breaks index into separate CHS values
        rather uses whole value as a single sequential index.

        Drive controller still addresses the disc as c/h/s layout.

      Greater design independence.

      LBA counts.
  
       22 bits - original IDE standard.
           IDE - independent drive environment (protocol)
       28 bits - ATA-1 (1994)
           IDE/ATA - AT attachment
       48 bits - ATA-6 (2003)
           ATA 1-6 - parallel interface with system.
           ATA 7 - SATA

      2^22 LBA * 512 (2^9) bytes/sector = 2^31 = 2 GiB.
       * Early systems set used 24 bits for CHS so LBA was fitted for that.
       * 4 sector/cluster up'ed storage to 8GB.

      2^28 LBA * 4KiB (2^12) bytes/cluster = 2^40 = 1 TB. (4K default for NTFS)

    Latest drives/OS/BIOS have gone to a 4K sector.
      know as Advanced format
      
      Allowed for smaller more standardized clusters.

      2^48 LBA * 4KiB (2^12) = 2^60   128 PiBytes (Peta-bytes).
      Modern BIOSes support 64 bit LBA.

    Zoning
      All tracks had the same number of sectors on early drives.

        Sectors on outer tracks more spread out and less prone to error.
          Used as early location of root directory.
    
          Directory later moved to center tracks to reduce average seek time.
    
      Zoning varies the number of secters for different radial zones on the 
        disc, with more sectors on the outer tracks.
    
          
          source : wikipedia
    
        All track in a zone have the same number of sectors.
    
        Different zones have different sector counts, more toward edge.
    
        Zoning generally not compatible with OS tracking of CHS requiring
         additional logic.  Another reason for LBA.
    
        Check out : https://hddscan.com/doc/HDD_Tracks_and_Zones.html 
    
Hard Drive sector arrangements
    - Preamble - preps the head for reading data, timing marks, sector id,
      header parity, flaw flag (marks sector as unusable),
      and, possibly, a pointer to replacement sector if marked bad.

    - Data - 512 bytes user data.
      * possible to low-level format for different size, but drives
        usually not portable between systems.

       Format/protocol uses NRZI and RLL encoding.
       And EPRML to retrieve bits.  Has no concern over what data is.
         see : 
           NPML - noise-predictive maximum-likelihood
         and 
           PRML - Partial-response maximum-likelihood.
     
       Legacy and smaller drives (< 500GB) use 512 byte sector. 

       Newer, larger drives may use use 4KiB sector.
         Or require larger clusters.

    - ECC block - error correcting code,
       Reed-Solomon - additional bits provide error detection/error recovery.
       Low-density Parity Check - fewer bits but more processing or controller
        memory, started to appear in 2009, also used in Wi-Fi and Gigabit
        Ethernet.

    - Inter-sector gap - spacing between sectors.

    Why you buy a X GB drive but end up with X-5% of storage space.
      Manufacturer counts all possible bits even if they are overhead.

    The move to 4096 byte sector from 512 byte sector is to provide a more
     efficient storage. 1 Preamble, 1 ECC block, and 1 gap for 8X the amount
     of data.

    ECC block - drives that support error correcting code.

      Check sums only detect error, ECC can repair some percentage of error.

      Older drives required 50 byte ECC for good 512 byte sector protection.

      4K sectors require 100 byte ECC for same quality protection.

  Drives (sometimes?) filled from the outside in, since linear disk speed 
    is faster and, if zoned, more densely packed providing faster data access.
    May increase chance of fragmentation.


More