(ZT) CHS conversion

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 the modulo operation, i.e. the remainder, and "÷" is integer 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]

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值