lkml.org 
[lkml]   [2001]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectDetermining maximum partition size on a hard disk
I am trying to calculate the maximum size a partition can be on a hard
drive and I ran into some problems I don't fully understand.

First I found that the maximum size of the drive Linux reports is not
the maximum size I get when I calculate it from the drives geometry.
Secondly, the total drive space reported by linux is not the amount
available for the maximum partition.

For example, I have a 4.3Gb disk. The drives geometry is 525 cylinders,
255 heads and 63 sectors (525 * 255 * 63 * 512 = 4318272000 or
4.318Gb).

This is an IDE disk so I found in /proc/ide/hdx/capacity a block size
8439184, which when divided by 2048 is 4120.7, ~200Mb less than what I
calculated as the disk size.

Finally, using a program such as fdisk or sfdisk I create a partition
manually to be the maximum amount allowed, which turns out to be 4217041
blocks, or, when divided by 1024 is 4118.2.

I assume that the difference between the maximum size that linux reports
and the maximum partition size is due to linux leaving room for a MBR
and such. If so how do I go about calculating this? Also why does the
size of the drive I calculate out by using the drives geometry differ so
much from the amount Linux reports? I thought maybe Linux set 1MB=1000k
but that doesn't seem to case.

Any information or a push in the right direction would be appreciated,
thanks!

Regards,
-Nick DeClario
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:57    [W:0.062 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site