(ZT) CHS conversion

来源:互联网 发布:wps表格怎么刷新数据 编辑:程序博客网 时间:2024/05/21 09:51

original url : https://en.wikipedia.org/wiki/Logical_block_addressing


In the LBA addressing scheme, sectors are numbered as integer indexes; when mapped to CHS (cylinder/head/sector)tuples, LBA numbering starts with the first cylinder, first head, and track's first sector. Once the track is exhausted, numbering continues to the second head, while staying inside the first cylinder. Once all heads inside the first cylinder are exhausted, numbering continues from the second cylinder, etc. Thus, the lower the LBA value is, the closer the physical sector is to the hard drive's first (that is, outermost[4]) cylinder.

CHS tuples can be mapped to LBA address with the following formula:[5][6]

LBA = (C × HPC + H) × SPT + (S - 1)

where

  • C, H and S are the cylinder number, the head number, and the sector number
  • LBA is the logical block address
  • HPC is the maximum number of heads per cylinder (reported by disk drive, typically 16 for 28-bit LBA)
  • SPT is the maximum number of sectors per track (reported by disk drive, typically 63 for 28-bit LBA)

LBA addresses can be mapped to CHS tuples with the following formula ("mod" is themodulo operation, i.e. theremainder, and "÷" isinteger division, i.e. the quotient of the division where any fractional part is discarded):

C = LBA ÷ (HPC × SPT)
H = (LBA ÷ SPT) mod HPC
S = (LBA mod SPT) + 1

According to the ATA specifications, "If the content of words (61:60) is greater than or equal to 16,514,064, then the content of word 1 [the number of logical cylinders] shall be equal to 16,383."[1] Therefore, for LBA 16450559, an ATA drive may actually respond with the CHS tuple (16319, 15, 63), and the number of cylinders in this scheme must be much larger than 1024 allowed by INT 13h.[a]

0 0
原创粉丝点击