## Calculating Cylinder / Head / Sector

If a particular disk has 6 surfaces and 50 sectors/track, what is the C/H/S (Cylinder/Head/Sector) location of absolute disk sector 454 (all values in decimal)?

Method: Calculate how many full cylinders and tracks precede the given sector.

Our desired sector is number 454, therefore 454 sectors precede it (those preceding disk sector numbers are #0 through #453 inclusive).

1. Calculate the number of full cylinders: C
Subtract the sectors contained in full cylinders that precede given sector.
Each cylinder contains 6 surfaces times 50 sectors = 300 sectors/cylinder.
Dividing 454 by 300 gives: 1 full cylinder with a remainder of 154 sectors.
Therefore, one full cylinder precedes sector number 454.
That cylinder is numbered zero, because cylinders number from zero.
Cylinder zero is full, so the cylinder that contains our sector must be the next (not full) cylinder after cylinder zero. That cylinder is number 1.
Therefore: C = 1
2. Calculate the number of full tracks: H
(Each track corresponds to a different surface and a different head. Track = head = surface.)
Subtract, from the sectors that remain, the sectors contained in full tracks that precede the given sector.
(These full tracks are in cylinder 1, calculated above.)
Each track contains 50 sectors.
Dividing the remaining 154 sectors by 50 gives: 3 full tracks with a remainder of 4 sectors.
Therefore, in cylinder 1, 3 full tracks precede sector number 454.
Those 3 tracks are numbered 0,1,2, because the heads (tracks) number from zero.
Tracks 0-2 are full, so the track that contains our sector must be the next (not full) track after track 2. That track is number 3.
Therefore: H = 3
3. Calculate the number of full track sectors: S
(Reprise: We calculated that cylinder 0 is full; tracks 0,1,2 of cylinder 1 are also full.)
How many sectors remain in cylinder 1, track 3 that precede the given sector?
The remainder of 4 above tells us that, in track 3 of cylinder 1, four track sectors precede sector number 454.
Those four track sectors are numbered 1,2,3,4, because track sectors number from one (not from zero).
Track sectors 1-4 are full, so the track sector that contains our sector must be the next sector after track sector 4. That track sector number is 5.
Therefore: S = 5

Therefore, disk sector 454 is located at (decimal) C/H/S = 1/3/5
This is head #3, which is the bottom head on the second platter.

Other calculations using the same disk geometry (for fun and practice):

``` 123 => 0/2/24   top
200 => 0/4/1    top
300 => 1/0/1    top
454 => 1/3/5    bottom
567 => 1/5/18   bottom
600 => 2/0/1    top
678 => 2/1/29   bottom
789 => 2/3/40   bottom
900 => 3/0/1    top
1200 => 4/0/1    top
8910 => 29/4/11  top
```