Subject: Re: Install of 1.5.1 on a Sparc 20
To: None <port-sparc@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-sparc
Date: 08/18/2001 02:48:10
> Note that each partition must be a complete cylinder on SPARC.

Sigh.  This is not true - or at least, if it is, it's gratuitous and
comparatively recent.

The issue is in the Sun-compatible disklabel.  It stores partition
beginnings in cylinders, and hence has no way to represent a partition
that does not begin on a cylinder boundary.

Now, the Sun-compatible label is needed if the disk is a boot disk
(since the ROMs must be able to understand it) or if it's to be shared
with other OSes that don't understand BSD labels.  While it's not truly
needed except for those cases, I think the kernel always writes it
anyway (it certainly used to) and hence rejects any label that cannot
be represented in the Sun-compatible format.

However, there has never been any requirement that partitions *end* on
cylinder boundaries.  If they don't, other than at the end of the disk,
there will be a small amount of unavoidably wasted space, but that's
about it.

> So, consult your disk geometry to figure out EXACTLY how many sectors
> per cylinder on your drive.

This betrays another (apparent) misconception.

On any even vaguely modern disk (basically, any disk that's likely to
be still in service), the number of sectors per track varies depending
on the cylinder number, in an attempt to keep bits-per-area at least
roughly constant across the disk.  This means that there simply is no
single sectors/cylinder number that matches reality.

So, how does this work with the above about partitions beginning on
cylinder boundaries?  Well, the `cylinder boundaries' on which
partitions must begin are not actual cylinder boundaries on the disk,
but rather multiples of the (sec/trk) * (trk/cyl) product, where those
two numbers are the ones in the disklabel.

Note that I did not say "the ones the disk reports".  The disklabel
values default to the ones reported by the drive, but you can put
whatever you please in for sec/trk and trk/cyl numbers, and the
`cylinder' boundaries you have to begin partitions on will be multiples
of their product.  (Well, there is a restriction; each number must fit
in 16 bits.)

It may work to simply set sec/trk=trk/cyl=1 in the label and put
partitions anywhere.  Some values in the Sun-style label are only 16
bits wide, but the starting cylinder numbers for partitions are not
among them.  (I think NetBSD doesn't care about any relevant values
that are only 16 bits, perhaps most notably the total cylinder counts;
you may have trouble if you try to share the disk with Sun OSes.)  I
haven't tried it myself, but I can't see any reason offhand why it
wouldn't work.

Personally, what I generally do is ignore the geometry reported by the
drive and set trk/cyl=32 and sec/trk=64 in the label, which gives me
1MB `cylinders'.  (Well, I record the drive-reported geometry in the
ASCII string field in the label, but that's purely for human
consumption.)  Then I just let there be a partial `cylinder' at the end
of the disk; it doesn't hurt anything.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B