Re: disk geometry change

Roger Gammans (rgammans@computer-surgery.co.uk)
Mon, 3 May 1999 13:45:49 +0100


In article <199904251319.PAA26535@wsdw01.win.tue.nl>, Guest section DW
<dwguest@win.tue.nl> writes
> From dledford@redhat.com Sun Apr 25 05:04:21 1999
>
> Guest section DW wrote:

> > It is a myth that it is possible to derive the geometry used
> > from the partition table. These days there seems to be a
> > fairly standard convention that partitions should end on a
> > cylinder boundary, but many fdisk versions will allow the
> > user to select arbitrary partition boundaries. Not only Linux
> > fdisk, but for example also certain Windows NT versions for
> > the Alpha do this.
>
> [snip]
>
> ... But, more directly to your complaint, it's easy
> enough to tell when the partition sizes you deduce from the disk don't
> match the capacity (or even come close) and fail on the partition based
> geometry detection. If you get fairly close, then you know you did the
> right thing. There's no myth about it except in your mind.
>
>Ah, Doug - you are angry and start writing nonsense.
>0. LILO and fdisk want to know H (the number of heads) and S (the number
>of sectors per track) and the total disk capacity.
>1. Now you come and look at a partition table.
>In the great majority of the cases you can read off H and S from
>the ending (c,h,s) of the first nonempty partition, since you will
>usually have H=h+1 and S=s. There is no way to derive the number
>of cylinders or the total capacity from the partition table.

Agreed. But there is a better way of deriving the H & S parameters,
since the Absolute Start and length of the partion are stored it is
possible use the soln 2 simultaneous eqns to get H & S.

I already a tool for I use in DOS which does exactly that.

>Since BIOSes usually do not tell you what the number of cylinders is
>because they are afraid of mentioning numbers above 1024, the only
>sensible thing is to set C = capacity/(H*S).
>There is nothing to compare to see whether you did right.
>It is fairly common to have partition tables that do not cover
>the entire disk.
>(And all this is assuming a DOS-style partition table, but people
>also use other kinds of partition tables, look at genhd.c and see
>what variation Linux supports today; trying to look at sector 0
>will certainly fail for such other partition table types.)
Indeed.

TTFN

-- 
Roger Gammans

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/