[vox-tech] Calculating partition sizes

Mark K. Kim vox-tech@lists.lugod.org
Wed, 14 May 2003 00:15:12 -0700 (PDT)


Quite quite interesting.  I was having problem because, for foolish
reasons, I was trying to store a 4 gig partition into a 1 gig partition.
Silly, silly me.  Anyway, I wanted to know how to figure out the partition
sizes anyway for a while so I figured I'd figure out this size-calculating
puzzle once and for all.

I don't wanna post my partition information since I don't want it to be
archived forever by the Internet for all the world to review, but here's
the relevant info from cfdisk:

   Total disk size: 80026361856
   Heads: 240
   Sectors per track: 63
   Cylinders: 10337

   Sum of cylinder counts of all partitions: 10337
   Sum of sector counts of all partitions: 156295440

And I'm thinking, okay - so if the MBR is supposed to take up 1 whole
cylinder, but that doesn't add up since all the partitions take up the
entire 10337 cylinders of the HDD.  Perhaps CFDISK isn't giving all the
information?

Something else interesting is that total disk size / cylinders yields a
non-integer (80026361856 / 10337 = 7741739.5623).  Perhaps the number of
bytes per cylinder is different for each cylinder, which is quite
possible, though I wonder if physical geometry means anything to software
anymore these days.

Anyway, assuming 512 bytes per sector, I should be getting 156295440 * 512
= 80023265280, but that's different than what CFDISK says the total size
of the disk is.

So anybody know what's going on?  This is a non-issue for me at the
moment but I'm still curious.

Thanks!

-Mark


On Tue, 13 May 2003, Mike Simons wrote:

> On Tue, May 13, 2003 at 04:32:22PM -0700, Micah J. Cowan wrote:
> > On Tue, May 13, 2003 at 03:49:29PM -0700, Mark K. Kim wrote:
> > > I'm trying to calculate the exact size of each partition (so I can dd it).
> >
> > I could be wrong, but can't you just dd 'em without specifying the
> > size? won't e.g. /dev/hda2 EOF when it reaches the end of the 3rd
> > partition?
>
> Micah,
>
>   Yes, you can just dd the partition... and it will stop with EOF.
> However, it will stop at the last block of hda2 not at the end of hda3.
>
>   I imagine Mark is trying to make sure he has enough space someplace.
>
> --
> GPG key: http://simons-clan.com/~msimons/gpg/msimons.asc
> Fingerprint: 524D A726 77CB 62C9 4D56  8109 E10C 249F B7FA ACBE
>

-- 
Mark K. Kim
http://www.cbreak.org/
PGP key available upon request.