Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are many sector numbering schemes on disk drives. One of the earliest was <em>CHS (Cylinder-Head-Sector)</em>. One sector can be selected by specifying the cylinder (track), read/write head and sector per track triplet. This numbering scheme depends on the actual physical characteristics of the disk drive.</p> <p>The first logical sector resides on cylinder 0, head 0, sector 1. The second is on sector 2, and so on. If there isn't any more sectors on the disk (eg. on a 1.44M floppy disk there's 18 sectors per track), then the next head is applied, starting on sector 1 again, and so on.</p> <p>You can convert CHS addresses to an absolute (or logical) sector number with a little math:</p> <pre><code>L = (C * Nh + H) * Ns + S - 1 </code></pre> <p>where <strong>C</strong>, <strong>H</strong> ans <strong>S</strong> are the cylinder, head and sector numbers according to CHS adressing, while <strong>Nh</strong> and <strong>Ns</strong> are the number of heads and number of sectors per track (cylinder), respectively. The reverse calculation (to convert LBA to CHS) is as simple as this.</p> <p>In this numbering scheme, which is called <em>LBA (Logical Block Addressing)</em>, each sector can be identified by a single number. The first logical sector is LBA 0, the second is LBA 1, and so on. This scheme is linear and easier to deal with.</p> <p><em>Clusters</em> are simply groups of <strong>continuous</strong> sectors on the disk, which are treated together by the operating system and the file system, in order to reduce disk fragmentation and disk space needed for file system metadata (eg. to describe in which sectors could a specific file found on the disk). A cluster may consist of only 1 sector (512 bytes), up to 128 sectors (64 kilobytes) or more, depending on the capacity of the disk.</p> <p>Again, the logical sector number of the first sector of a cluster can be easily calculated:</p> <pre><code>L = ((U - Sc) * Nc) + Sd </code></pre> <p>where <strong>U</strong> is the cluster number, <strong>Nc</strong> is the number of sectors in a cluster, <strong>Sc</strong> is the first valid cluster number, and <strong>Sd</strong> is the number of the first logical sector available for generic file data. The latter two parameters (Sc and Sd) are completely filesystem and operating system specific values.</p> <p>Some filesystems (for example FAT16, and the whole FAT-family) reserve cluster number 0 and 1 for special purposes, that's why the first actual cluster is cluster number two (Sc = 2 in this case). Similarly, there may be some reserved sectors in the beginning of the disk, where no data is allowed to be written to and read from. This reserved area can range from a few sectors (e.g. a boot record) to millions of sectors (e.g. a completely different partition which preceeds our partition on the hard disk).</p> <p>Huh, this was the long answer. After all, the short answers to your questions can be summarized as follows:</p> <ol> <li><p>No, LBA 0 is not always cluster 2, it's filesystem specific (in case of FAT, cluster 2 is the first available sector on the disk, but not always LBA 0 - see answer 5).</p></li> <li><p>Interpretation of cluster number 0 and 1 are also filesystem specific (in case of FAT, cluster number 0 represents an empty cluster in the File Allocation Table, and cluster number 1 is reserved).</p></li> <li><p>No, the main difference is that a cluster number addresses a group of continous sectors, while LBA addresses a single sector on the disk.</p></li> <li><p>See the formulas (formulae?), and the accompanying description in the long answer above.</p></li> <li><p>It's hard to tell from such a short assembly code, but my best guess would be the number of reserved sectors in the beginning of the partition (noted by <strong>Sd</strong> in the formula above).</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload