Subject: Re: Need help with disklabel on sparc64
To: None <port-sparc64@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-sparc64
Date: 06/25/2003 15:27:16
> [moving disk from i386 to sparc64]

> Tips/hints?  Are there any incompatibilities between i386 and sparc64
> disklabels, or we need to take a step we're forgetting?

Well, others have remarked that the i386 uses BSD disklabels (though
with the MBR partitioning as an additional helpful little complication)
while the sparc64 is said to use Sun disklabels (I can't speak to that
personally, but it certainly sounds plausible).  If so, this will
certainly be a fruitful source of incompatability.

I have programs designed to read BSD or Sun disklabels on any machine.
If built for (and running under) NetBSD, they can also set the software
label for a disk without bashing on what's on the disk; I routinely use
this to run i386-setup disks on an Alpha.  (I just found the correct
block number and offset for the i386-written label, then my program
reads it and sets the kernel's label, and all the partitions and the
filesystems within them are right there.  The Alpha uses BSD labels
too, but puts them at a different place on the disk.)

In your case, I'd

(a) Compile the BSD-label-reading program on the sparc64 (perhaps
    booted off the install CD or some such);

(b) Put the disks back on i386 and write down fdisk output (so you know
    where the BSD disklabel is);

(c) Put the disks on the sparc64 and run the BSD label reader to load
    the label, then tell it to set the kernel label.  Then suspend it
    (it might work to just quit it; I'd have to try it) and go ahead
    and use the partitions all you like.  (If the filesystems are
    i386-native endianness, you'll need a sparc64 kernel with FFS_EI.)

Of course, I'll be happy to send a copy of the label-reading programs
to anyone who wants them.  I've also put copies of them up in
ftp.netbsd.org:/pub/NetBSD/misc/mouse/hacks/ in bsdlabel.c and
sunlabel.{c,doc}.  (I haven't got around to writing a doc file for
bsdlabel; reading sunlabel.doc and the output from bsdlabel's ? command
will give you most of it.)

/~\ 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