*BSD News Article 40075


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!yarrina.connect.com.au!warrane.connect.com.au!godzilla.zeta.org.au!not-for-mail
From: bde@zeta.org.au (Bruce Evans)
Newsgroups: comp.os.386bsd.questions
Subject: Re: size of d partition determination is wrong. Why?
Date: 1 Jan 1995 12:00:01 +1100
Organization: Kralizec Dialup Unix Sydney - +61-2-837-1183, v.32bis v.42bis
Lines: 44
Message-ID: <3e4uqh$738@godzilla.zeta.org.au>
References: <D1F1Kw.H71@luva.lb.bawue.de> <3dnbr9$bgo@agate.berkeley.edu> <D1n8Iz.8x@luva.lb.bawue.de>
NNTP-Posting-Host: localhost.zeta.org.au

In article <D1n8Iz.8x@luva.lb.bawue.de>,
Michael Giegerich <migieger@luva.lb.bawue.de> wrote:
>In article <3dnbr9$bgo@agate.berkeley.edu>,
>Jordan K. Hubbard <jkh@violet.berkeley.edu> wrote:
>>In article <D1F1Kw.H71@luva.lb.bawue.de>,
>>Michael Giegerich <migieger@luva.lb.bawue.de> wrote:
>>>
>>>Automatic partition of my Fujitsu 1gig drive get's wrong the size for the 
>>>d partiton.
>>
>>Just remove d from the list of partitions if you're editing the disklabel.
>>There don't need to be entries for c and d since they're special cased
>>anyway.  And yes, we should probably fix the disklabel we write out initially.

>Diggin' some further I've seen that disklabeling my disk changes
>the in-core label but not the on-disk label :-(

The c and d entries are essentially read-only.  It's a bug that the
disklabel editors allow you to change the in-core label.

The c partition size is filled in at boot time if the disk has a normal
DOS partition table.  See isa/readMBR.c.  The d partition size is always
filled in at boot time, at least for the sd and wd drivers.  See scsi/sd.c
and isa/wd.c.  wd.c prints a message if it changes the value.

The original problem is probably because the cylinder, head and sector
counts are ususually fictitious for modern drives.  Either the drive
or the driver invents numbers such that

	cylinders * heads * sectors_per_head < total_sectors.

It is unusual for total_sectors to have a lot of divisors, so the
inequality is usually strict.  The cylinder, head and sector counts
aren't used for anything important or good, so SCSI the driver ignores
them when it writes the initializes the size of the d partition to
total_sectors.  This avoids wasting the sectors "after" the last
cylinder.  The sd driver has no problems with the extra sectors, but
utilities might.  bad144 has bugs related to this, but bad144 is not
supported by the SCSI driver.

The IDE driver doesn't support sectors on the cylinder "after" the last.
They may exist, but there is no standard way to know how many there are.
-- 
Bruce Evans  bde@zeta.org.au