CHS vs. LBA addressing

Introduction

CHS and LBA addressing schemes are methods for a computer to reference sectors on a drive. We’ll go over some basics to know first before tackling the differences between the two.

Basics

I might create a separate post on how a disk is read. The video below does a great job of introducing the components of a hard drive, such as platters, tracks, cylinders, and how it’s read.

A couple notes from the above video:

  • A hard disk has multiple platters. Each platter has 2 heads (one on the top and one at the bottom).
  • A hard drive is made up of multiple tracks (or cylinders).
  • A platter on a disk is made up of tracks starting from 0 (outside-most track) to the largest number (inner-most track).
  • A track is a circular ring similar to a running track.
  • Each track is made up of sectors, which is the smallest storage unit in a disk and is usually 512 bytes long.

CHS addressing basics

CHS (or Cylinder-Head-Sector) was the old addressing method used. There are older disks that will still use this scheme. Two big reasons that CHS is no longer used are:

  • LBA replaced CHS as older BIOS using CHS addressing could only translate the address ranges up to 8.1 GB.
  • Outer tracks had more sectors than inner tracks. This led to weird geometry where calculations were not always accurate

How does CHS work?

Figure 1: 3D version of what’s in a hard disk

It is easier to understand all the components of a hard drive and CHS addressing from a 3D level. The format of a CHS number is C/H/S, starting with Cylinder 0/Head 0/Sector 1. The first sector of a track always starts at 1.

Figure 2: 2D version of a single platter

Let’s try to find 1/1/3 in CHS format with the help of Figure 2.

  • The first step is CHS addressing is using the Cylinder value (1/1/3) to find the track. The outer-most track is 0, so the 2nd outer-most track (Track #1) is what the C in CHS will find. At this point, all platters at track #1 is a possibility for the sector we want.
  • The second step in CHS is using the Head value (1/1/3) to find the platter and side. The bottom platter has head 0 (at the top) and head 1 (at the bottom). We have narrowed the answer to the first platter with the head at the bottom side, at the 2nd outer-most track.
  • The last step is using the Sector value (1/1/3) to get the sector at the track. The first sector value at a track is 1. The third sector at the track specified in the previous 2 steps is the final answer.

LBA Addressing

LBA addressing was used to resolve concerns given above about CHS addressing. LBA is a linear number scheme that is easier to understand than CHS. LBA starts at sector 0 and goes up by 1 for each sector.

Convert from CHS to LBA

There is a way to convert from CHS to LBA, but we’ll need more information to perform the conversion. The heads per cylinder and sectors per track information can be found on the hard drive manufacturer’s website. The following formula will do the conversion given you know the C/H/S numbers.

2 responses to “CHS vs. LBA addressing”

  1. Thanks for the article, this is cool! Really does make a lot more sense actually being able to see it in 3D like you detailed. 🙂

    Liked by 1 person

    1. Thanks for visiting! I am going to be posting more in the future. If you have any suggestions on articles, please let me know!

      Like

Leave a comment