Subject: Re: Installation problem
To: Colin Wood <cwood@ichips.intel.com>
From: Frederick Bruckman <fb@enteract.com>
List: port-mac68k
Date: 09/04/1998 20:07:38
On Fri, 4 Sep 1998, Colin Wood wrote:

> Bob Nestor wrote:
> > Also on one of my new disks I see that the Installer 1.1e reports 9 
> > partitions, but Installer 1.1g reports only 7. Attempting to access this 
> > disk under NetBSD with either disklabel or newfs causes a system crash 
> > (illegal instruction) at the end of the process. Is it possible there's 
> > an off-by-one error in the fake disklabel code?  I'm about to test this 
> > by further reducing the partiton count on the disk.
> 
> i'd say quite possible.  well, at least something seems to be screwy, b/c
> i've noticed that the more you mess with the partition map, the less
> likely netbsd is going to be able to read the disk.  i resized and deleted
> a couple of partitions on one of my disks, and i'm pretty sure i cannot
> access the original netbsd partition on the disk now; it panics the
> machine to do a disklabel on that drive :-(  i haven't looked at it in a
> while now, tho.

That's consistent with my own observations. Evidently, NetBSD doesn't sort
out the partition chain the same way that MacOS does. I've had some
success editing the partition tables by hand, with Norton's Disk Editor,
but that's only for the very bold! A corrupted partition map can prevent
MacOS from booting with that drive powered up, which makes recovering from
a mistake very interesting. The short answer is, you can't have more than
eight blocks at the start of the disk that have the partition table magic.
Number nine always causes NetBSD to choke.

That eight includes the partition map, the driver(s), and the "free list."
Lacie's driver is fairly kind, in that it only installs one driver, and
it's "free list" has a different signature than a proper partition map.
That leaves you with up to six partitions for NetBSD on a freshly
formatted disk.

FWB Tools is terrible. It installs at least two partitions for its driver,
then there's the map, and the "Apple Free" partition. (Even if you think
you've used every block, FWB Tools tends to leave a single block "Apple
Free" partition.) If it's a removable drive, it also makes an IDE driver.
That leaves three partitions for NetBSD, in the general case: root, swap,
and either MacOS or usr.

Moving/resizing/deleting partitions doesn't always help. Deleting a
partition, for example, removes its entry from the "Apple Partition Map",
i.e. the index, but the block with the partition table signature is still
there, and that's what NetBSD picks up.

If you suspect that this bug is biting you, you can open the disk with
Mkfs. This is safe, as long as you don't actually change anything. Mkfs
evidently uses the same code as the NetBSD mac68k kernel. The first
parition map and the driver are never shown, but the free list, and other
garbage will be, as well as all your bona-fide partitions. You'll need to
see no more than six items here, if NetBSD is going to work with that
drive. If not, I suspect most people would want to back up and reformat.