CHS to LBA mapping - (Disk Storage)

末鹿安然 提交于 2020-01-16 01:09:10

问题


Before LBA you simply had the physical mapping of a disk, which on originally on an old a IBM-PC compatible machine would look something like this the following:

  • Cylinder Number : (10-bits)
    • 0-1024 (1024 = 2^10)
  • Head Number : (8-bits)
    • 0-256 (256 = 2^8)
  • Sector Number : (6-bits)
    • 0 is reserved typically for the "boot sector" (c-0,h-0,s-0)
    • 1-64 (63 = 2^6 - 1) *0 is reserved

Total CHS address bits : 24-Bits


Back in day the average (file|block|sector) size was 512B.

Example from wikipedia:

512(bytes) × 63(sectors) x 256(heads) × 1024(cylinders) = 8064 MiB (yields what is known as 8 GiB limit) 

What I'm confused on is what a head actually means, when referred to as heads-per-cylinder in the LBA formula. It doesn't make sense to me because from what I know a head is head, and unless it removable media each platter has two of them (top,bottom) for each of the it's surfaces.

In my mind it would make more since to referred to them as heads-per-disk or heads-per-surface, since a cylinder goes through the entire disk (multiple platters).


Logical Block Addressing:

Formula: A = (c ⋅ Nheads + h) ⋅ Nsectors + (s − 1)

  • A - Logical Block Address
  • Nheads - Number of heads on a disk heads-per-disk
  • Nsectors - Numbers of sectors on a track sectors-per-track
  • c,h,s - is the cylinder,head,sector numbers 24-bits total (10+8+6)

Looking at the first example on here:

For geometry 1020 16 63 of a disk with 1028160 sectors CHS 3 2 1 is LBA  3150=(3× 16+2)× 63

Geometry:

  • Cylinder Number - 1020 (0-1024)
  • Head Number - 16 (0-256)
  • Sector Number - 63 (1-64)

How are these geometry CHS number mapping in to the CHS tuple (3,2,1) to be used in this formula?


回答1:


I don't think heads is a number to be taken too literally. I've taken a few apart to salvage the neodymium magnets and only ever seen one disk, except on big 5-1/4 inch drives. And 2 heads. And cylinders start at 0 but heads and sectors start at 1. Some early Windows versions could only deal with 255 heads so the numbers get played with.

Short answer: Multiply cylinder # times head # times sector # and it's close to LBA. I tried pasting an OpenBSD fdisk listing in here but it's a whole 80 characters wide and the web page wouldn't take it.



来源:https://stackoverflow.com/questions/32642016/chs-to-lba-mapping-disk-storage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!