In order to find a single sector we need to know the cylinder, the head the and the sector number for that track (eg.cyl 89 head 2 sector 72), this is called CHS (Cylinder – Head  – Sector) addressing. The operating systems normally use a Logical Block Addressing (LBA) able to skip and relocate the bad sectors; this is done assigning to the CHS positions an LBA value, each time a bad sector is found the chs value assigned to that single LBA is changed to the first spare sector available. The maps of these relocations are called P-list (permanent list) created during factory test and the G-list (growing list) updated each time a relocation takes place

Convertion From CHS to LBA

The equation to convert from CHS to LBA follows: LBA = ( ( CYL * HPC + HEAD ) * SPT ) + SECT – 1
LBA: linear base address of the block
CYL: value of the cylinder CHS coordinate
HPC: number of heads per cylinder for the disk
HEAD: value of the head CHS coordinate
SPT: number of sectors per track for the disk
SECT: value of the sector CHS coordinate
TEMP: buffer to hold a temporary value
This equation is not used very often. Usually the software already has the LBA value and needs to calculate the CHS value for it.

Convertion From LBA to CHS

CYL = LBA / (HPC * SPT)
TEMP = LBA % (HPC * SPT)
HEAD = TEMP / SPT
SECT = TEMP % SPT + 1

This equation is used very often by operating systems such as DOS to calculate the CHS values it needs to send to the disk controller or INT13h in order to read or write data.

chs-lba-addressing-conversion
Data recovery Salon welcomes your comments and share with us your ideas, suggestions and experience. Data recovery salon is dedicated in sharing the most useful data recovery information with our users and only if you are good at data recovery or related knowledge, please kindly drop us an email and we will publish your article here. We need to make data recovery Salon to be the most professional and free data recovery E-book online.