Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!

Monday, May 18, 2009

Partition of a drive

The criteria that Microsoft uses when partitioning a drive is as follows.
The boot sector always resides at sector zero, this is and industry requirement and not from Microsoft.
All OS boot partitions reside on a head boundary.
In the past there was a cylinder, head, sector layout for hard drives. This comes from before LBA addressing and when drives were extremely slow.
It was always advantageous that when a drive did a seek it would do as much work as possible while it was out on the platter since seek times were horrible.
So, in a single platter, dual head drive on bootup the drive would seek to Cylinder 0, Head 0, and Sector 1, read the bootstrap code at that address and execute it.
The bootstrap would have a table that included where the OS boot data was located.
Instead of seeking to a new area on the drive, the drive would just switch heads and read from Cylinder 0, Head 1, Sector 1.
That is where the OS boot record would normally be. In other words, it is by design that you lose the first 63 sectors of a drive.
In addition, every additional partition will start on a head boundary, so again you lose 63 sectors. If you are using extended partitions you will lose 126 sectors as one starts on head boundary 1 and the other starts on head boundary 0.
There is no way to avoid this, and even after LBA addressing was instituted and drive platter and head numbers became irrelevant. Microsoft, and the industry as a whole, kept this formula. I for one am glad as it makes data recovery much easier when there are a set of rules and these rules can be applied when looking for file system components.
In reference to partition sizes all partitions end on head 254.
The tools that create a partition know that and so when you type in you want your drive ‘C’ to be a 16 GB partition the following formula is used.
There are 63 sectors per track, and 255 tracks per cylinder.
There are 2048 sectors per megabyte of storage and 2097152 sectors per gigabyte of storage. Multiply 63 sectors time 255 tracks you get 16065 sectors per cylinder.
You want 16 GB, so you multiply 16 times 2097152 and that equals 33554432 sectors.
Now we divide 33554432 sectors by 16065 and we get 2088,666791 cylinders.
Truncate the value to 2088 and then take that value and multiply that times 16065 and that value is the actual space Microsoft will allot you for your partition.
In this case 15,99489212 GB of allocated partition space.
Sometimes fdisk will do something weird to optimize the storage but this calculation is fairly close.
In reference to the cluster size the smaller the cluster more of the disk is used, however, you sacrifice speed for small cluster sizes for two reasons.
How the OS buffers depending on cluster size and secondly smaller clusters tend to fragment more as it is easier to use all the space when the areas you can store things in is smaller.
In other words it is easier to store a mouse than an elephant.

No comments: