Subject: Re: dd: /dev/rsd0b: Read-only file system
To: None <port-sparc@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-sparc
Date: 12/10/1999 22:47:40
> Is a normal partition (eg. ffs) allowed to start from sector 0?

Yes; as others have said, filesystems tend to skip the first few
sectors; ffs skips the first 8K, for example.

> Installboot man page [for sparc] tells that the first-stage
> bootprogram is written into the superblock,

This is slightly incorrect; the boot program is never written into the
superblock.  One boot program exists in the first 8K of the disk, just
past the label in sector zero; writing this here is installboot's job.
The next boot program exists in a plain file anywhere in the boot
partition, canonically /boot, and installboot plugs its block numbers
into the other boot program - this is the main reason installboot
exists (rather than, say, using dd to drop the program into place).

One caveat: some boot ROM versions always use 6-byte CDBs, which means
that all the blocks making up the second-stage boot program (the one
that normally lives in /boot) must be in the first gigabyte of the
disk, regardless of partition boundaries.  In practical terms (given
the lack of control userland has over block placement), this means that
the boot partition must be contained within that first gigabyte.

> The install document tells me to put partition boundaries at cylinder
> boundaries for SunOS filesystem compatibility.  This is only a
> filesystem thingie, ie. I can begin the swap partition wherever I
> want, right or wrong?

No; it's a label thingy.  SunOS-compatible disklabels cannot represent
partitions that do not begin at "cylinder" boundaries.  I put
"cylinder" is in quotes because it really doesn't matter where cylinder
boundaries actually are; the truth is that the label contains
sectors/track and tracks/cylinder numbers, and the product of these two
numbers is multiplied into a partition starting point number to get the
partition's offset in sectors.  (Unfortunately you generally can't just
set the s/t and t/c numbers to 1 and then use sector offsets for
everything because the "starting cylinder" values are only 16 bits
wide.  Yes, this is arguably stupid, but with the huge number of
systems in the field with boot ROMs that know about only this label
format, we're stuck with it for the foreseeable future.)

Now, this doesn't matter if you're not using a SunOS-compatible
disklabel.  But for the boot ROMs to understand a disk, it has to have
such a label, so at least your boot disk needs to have one.  I've seen
it said that NetBSD can deal with having a native NetBSD label on a
disk instead of (or in addition to, I'm not sure) a SunOS-style label;
I've never tried it myself.

					der Mouse

			       mouse@rodents.montreal.qc.ca
		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B