On 6/5/05, Gregory K. Ruiz-Ade <[EMAIL PROTECTED]> wrote:
> On Jun 4, 2005, at 10:15 PM, Lief Hendrickson wrote:
> 
> > Here's something strange I noticed in the comparison between the
> > two fdisk reports above.  Your partitions start with the next
> > cylinder, e.g. sda1 ends with 262 and sda2 starts with 263.
> > However, mine starts with the same one, e.g. hda1 ends with 2710
> > and hda2 starts with 2710 (the same one).  Maybe the partition
> > boundary is somewhere within the same cylinder.  Are the boundaries
> > supposed to be between cylinders?  I'm wondering if this is the
> > overlap problem on my system that Partition Magic complained about.
> > Ideas anyone?
> 
> fdisk, as supplied with Linux, will never allow you to start a new
> partition on the ending cylinder of another partition, in my experience.
> 
> Then again, I could be wrong. :)

I think you are right, and I think that whatever program set up the
partition table so that the end of one partition had the same cylinder
number as the beginning of the next was wrong.  This might not hurt
until some process wants to write all the way to the end of a
partition.

In fact, I bet that if you do a "mkfs" on a low-order partition it
will wipe out information at the beginning of the next partition.  Of
course, if you only "mkfs" in sequence from low to high cylinder
numbers, you will never notice this.

The other anomaly, having more blocks in the raw disk than in the
partitioned disk is fairly easy to explain.  Taking Neil's example:

>Disk /dev/sda: 36.7 GB, 36722061312 bytes

This information comes from the disk firmware, and is the
manufacturer's idea of how big the disk is.  It is not computed by any
software such as fdisk.

>255 heads, 63 sectors/track, 4464 cylinders
>Units = cylinders of 16065 * 512 = 8225280 bytes

This information is generated by "fdisk" and is fictional.  It is
related to the fact that some PC hardware can't address more than 255
heads or 63 sectors.  Doesn't everybody use LogicalBlock Addressing
nowadays?

>    Device Boot    Start       End    Blocks   Id  System
>/dev/sda1   *         1       262   2104483+  83  Linux
>/dev/sda2           263       393   1052257+  82  Linux swap
>/dev/sda3           394      4464  32700307+  8e  Linux LVM
>
>255 * 63 * 4464 * 512 = 36717649920
>36722061312 - 36717649920 = 4411392

Fdisk can only allocate space in units of its fictional cylinder size,
so there will almost always be some part of the disk left over that
doesn't fit into a full cylinder.  Back in the olden days, when disks
were smaller and disks space was more precious, one tried to fit the
cylinder size to the physical disk size so there wasn't anything left
over.

The leftover in this case is about 1/2 of a cylinder.  Seems to me
that old-time Unix mkfs would tell you "xxxx bytes left over in
unallocated cylinder".

    carl
-- 
    carl lowenstein         marine physical lab     u.c. san diego
                                                 [EMAIL PROTECTED]

--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-newbie

Reply via email to