From owner-freebsd-hackers Thu Mar 28 02:54:19 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id CAA16453 for hackers-outgoing; Thu, 28 Mar 1996 02:54:19 -0800 (PST) Received: from irz301.inf.tu-dresden.de (irz301.inf.tu-dresden.de [141.76.1.11]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id CAA16423 for ; Thu, 28 Mar 1996 02:54:08 -0800 (PST) Received: from sax.sax.de by irz301.inf.tu-dresden.de (8.6.12/8.6.12-s1) with ESMTP id MAA28765; Thu, 28 Mar 1996 12:51:40 +0200 Received: by sax.sax.de (8.6.11/8.6.12-s1) with UUCP id LAA14519; Thu, 28 Mar 1996 11:51:39 +0100 Received: (from j@localhost) by uriah.heep.sax.de (8.7.4/8.6.9) id JAA23576; Thu, 28 Mar 1996 09:39:06 +0100 (MET) From: J Wunsch Message-Id: <199603280839.JAA23576@uriah.heep.sax.de> Subject: Re: fdisk and partition info To: freebsd-hackers@freebsd.org (FreeBSD hackers) Date: Thu, 28 Mar 1996 09:39:05 +0100 (MET) Cc: jerry@border.com Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) In-Reply-To: <199603271949.MAA01736@phaeton.artisoft.com> from "Terry Lambert" at Mar 27, 96 12:49:37 pm X-Phone: +49-351-2012 669 X-Mailer: ELM [version 2.4 PL24 ME8a] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk As Terry Lambert wrote: > > All of it is for FreeBSD. When I do a 'fdisk wd0' > > it only reports 24MB.. Now then, can I assume the 24MB amount is due to > > the 1024 cylinder limit? Nope. This is due to a faked fdisk entry. The embedded fdisk table in the boot1 structure (see /sys/boot/biosboot/) faked a 50000 blocks BSD fdisk entry. Until very recently, ``disklabel -B'' was always clobbering the existing fdisk table when installing a new bootstrap. This left you with a dummy fdisk table (though the slice code knew about this one, and assumed a full BSD slice). If you didn't use a ``dangerously dedicated'' BSD slice, you might not have noticed this, since the BSD disklabel wasn't at offset 0 in the disk. Only for ``dangerously dedicated'', the BSD label is the MBR itself, hence the embedded fdisk table in the BSD label is of any interest. > 1) Assume the geometry is translated, and that it is > 1024/64/256. This is what the current FreeBSD slice > code does, much to the consternation of those of us > who own WD1007 or other non-translating controllers. This is not right. The FreeBSD kernel gets the BIOS geometry (for the first N BIOS drives) passed from the bootstrap. This might or might not be a `translated' one (though it's normally translated for all modern disks). The WD1007V *can* translate. It has a few hardware translation options. They were commonly used to remap drives with more than 1024 physical cylinders into the BIOS accessible range. (The geometry of ESDI drives usually could be expressed by a ``real'' CHS value, i.e. they didn't do any fancy Zone Bit Recording or other stuff all modern drives do.) The consternation does only result out of the usage of ``spare sectors'' at controller level on the WD1007V. Don't use them, and you should be going. (You can always use bad144 sector sparing, and if your drive exceeds 1024 cylinders from a BIOS point of view, you could handle this by using two BSD slices, where the first one is below 1024 and contains at least the root f/s.) > 2) Interpolate the geometry from an existing DOS partition > table, and the known rules of behaviour for the DOS fdisk > program. Specifically, starting and ending on cylinder > boundries, etc.. Since it is possible to have multiple That's what libdisk does. While this is a good idea for drives that do already have a DOS partition, it can cause some serious troubles for uninitialized disks (or disks with non-fdisk-table previous operating systems). This is what caused the ``You'd best install a DOS partition first'' attitude for FreeBSD 2.0.5. (And since this attitude deemed to be unacceptable for people who didn't wanna care about any DOS partition at all, since all they want is FreeBSD, this caused me to invent the ``dangerously dedicated'' mode of installation.) > geometries result in the same values, especially when you > have a small number of partitions (for instance, one), > this is not a 100% reliable approach -- in general, it is > so *unreliable* that the slice code was invented to replace > it. It's possible to "help" this approach be more accurate The slice code was invented to cover multiple fdisk slices at all, e.g. to handle more than one slice with a 0xa5 signature (though you can still only boot from the first one), or to handle ``DOS extended partitions''. > using the 32 bit absolute sector address, which is also in > the partition table. The problem with that is that older > FDISK programs did not generally fill out the 32 bit sector > offset correctly, so determining this information is usually > no more reliable if the offset happens to check a valid > geometry [NB: the FReeBSD FDISK should always fill these > fields out correctly in any case). fdisk did always fill out these parameters correctly (or at least, it told you about its idea before writing them to the disk, so you've been able to manually intervent if the idea was wrong). Only a ``disklabel -B'' installed a bogus fdisk table, see above. > 3) Ask the BIOS. There are several ways to do this: > b) Implement a multi-stage boot as opposed to a two > stage boot, ... Funny, our two-stage boot does already ask the BIOS, and pass these values to the kernel. UTST. (Use the source, Terry. :) -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)