CHS address and LBA address

Tram Ho

“The article is used as a supplementary material for the Linux System Administration Series”.

In addition to the LBA (Logical Block Addressing) method for addressing data blocks on hard drives, the CHS (Cylinder-Head-Sector) addressing method is still an important method of partitioning devices. Storage as hard disk or SSD. Do you want to access the hard drive partitions in a specific and clear style? So it is impossible not to mention CHS .

1. CHS – Cylinder – Head – Sector

CHS is a method of locating hard drives that appear very early. Although addressing with drives with CHS today is not recommended due to modern drive specifications, they are still used by many utilities. Here are some of the terms used:

  • Tracks : Concentric circles on the hard disk.
  • Each track is divided into multiple sectors
  • Each hard drive consists of multiple hard disks affected by magnetic fields (magnetic disks), each with a moving bar (Arm) with two heads (Head) magnets, one on each side.
  • Cylinder – cylindrical: Imagine a circular cylinder passing through tracks with equal radius on magnetic disks, the cylinder is called Cylinder .

screen-shot-2016-10-28-at-2-15-19-pm

  • The sectors on magnetic disks can be positioned with CHS “coordinate system”. CHS stands for:
  • C – Cylinder: Cylinder index, from 0 to 1023
  • H – Head: Index of magnet head. A moving bar has two magnets, the top has an index of 0, the lower end has an index of 1. If there is a second moving bar, the top is the second bar with an index of 2, the lower end is 3, similar to other magnets if available. The value of H is from 0 to 254, previously only 0 to 15.
  • S : Sector, the value of S in the range of 1 to 63
  • A set of sectors on a track is called a cluster .

Of course, the aforementioned ranges do not tell the truth in fact, there is no drive containing 128 disks from it. Today, CHS addresses are mainly used in utilities to help partition disks. As we can see, the values ​​of C and H start at 0, and the value of S starts at 1. The first sector of the drive will be located at 0/0/1 . In theory, each sector is a block of 512 bytes, although the sector with a sector of up to 4096 bytes has appeared since 2010. If each sector is 512 bytes, the maximum volume that the drive carries 7.844 Gigabytes (1024 x 255 x 63 x 512 = 8,422,686,720: eight billion four hundred and twenty two million six hundred eighty six thousand and seven hundred and twenty bytes)

Logical Block Addressing – LBA – Logical Block Addressing – another method used to type in the disk storage unit.

For hard drives larger than 7,844 Gigabytes, CHS seems impotent, but for compatibility reasons (at least for booting the system for example), we still have to resort to it. Modern BIOSes can now switch to LBA mode easily through extensions of interrupt Int13H (an interrupt defined in x86 architectures, which will set up the service to read / write sectors of the hard drive or soft, based on CHS coordinate system – Wikipedia ).

The LBA concept erases the definitions of Cylinders and Head in CHS . The LBA address system sees the drive as a storage entity that holds consecutive blocks . So it can be said that the LBA address system is a linear address system , meaning that the first block will have address 0 ; and the last block will own the highest address, depending on the drive size and the area of ​​the block.

Instead of specifying the location of Cylinder, Head and Sector as in CHS, the disk controller only needs to know the LBA address of a block to access it easily. Using LBA, the drive can access output more blocks only, meaning that its capacity may be larger. Note that the block concept in LBA is equivalent to the sector in CHS.

3. MBR – Master Boot Record

The first sector of a drive has been partitioned. (LBA 0 or CHS 0/0/1 ), it contains:

  • Master Boot Record (MBR) : A small program, the first program called by BIOS. After conducting the operation (for example, asking the user to select the operating system to boot into), it will load the operating system into RAM and transfer the machine control back to the operating system.
  • Master Partition Table (MPT) : A table containing information about the partitions in the drive, enough space to hold the maximum information of 4 partitions. Each drive’s information is stored in a 16-byte wide entry. Information can be filesystem, cluster, size … v … .v ….
  • The limit on the number of partitions is no longer true on GPT drives.

4. Extended partition table – Extended Partition Table

The partitions are divided into two types, the primary partition and the extended partition . Extended partitions can also be divided into other logical partitions .

Logical partitions are not defined in MPT, their partition table is located in the first sector of the Extended Partition Table (EPT ). Similar to MPT, EPT also has only 4 16byte entries, storing information about up to 4 logical partitions. However, we never use more than 2 entries.

If there are more than two logical partitions, a linked list of EPTs will be created.

ITZone via Kipalog

Share the news now

Source : Kipalog