Subject: Re: 1.6 installation via Hard Disk swap
To: None <port-cobalt@netbsd.org>
From: ian <cobalt@minimal.cx>
List: port-cobalt
Date: 11/06/2002 12:32:33
Hi Daniel,

On Mon, Nov 04, 2002 at 08:29:28PM -0500, Daniel Ouellet wrote:
> 
> So, I think now the easiest for me is simply to put the drive in a
> different BSD workstation and do what ever need to be done to get it up
> and running. After I do it once, it really should be really quick to do
> all the 11 others.
> 
I have just moved my one Qube 2 to 1.6 by using an external system.

> Any help, specially useful URL to example would be more then welcome if
> I can abuse of your time a bit.
> 
Well, I'll try - I was having to learn about disklabels and partition maps
along the way, so I may have the reasons behind certain actions incorrect:
hopefully other will jump in when I make a mistake.

I wanted to install to a new larger harddrive, but without destroying
the original disc.  I used my wife's PC with a NetBSD live CD image so I
didn't have to install anything, or risk deleting any of her data.  After
booting the CD-ROM, I used fdisk to set up my drive (a 17GB Fujitsu) as
follows:

Disk: /dev/rwd0d
NetBSD disklabel disk geometry:
cylinders: 16383 heads: 16 sectors/track: 63 (1008 sectors/cylinder)

BIOS disk geometry:
cylinders: 16383 heads: 16 sectors/track: 63 (1008 sectors/cylinder)

Partition table:
0: sysid 131 (Linux native)
    start 63, size 40960 (20 MB), flag 0x0
        beg: cylinder    0, head   1, sector  1
        end: cylinder   40, head  11, sector 10
1: sysid 130 (Linux swap or Prime or Solaris)
    start 41024, size 262144 (128 MB), flag 0x0
        beg: cylinder   40, head  11, sector 12
        end: cylinder  300, head  12, sector 12
2: sysid 169 (NetBSD)
    start 303169, size 33488896 (16352 MB), flag 0x0
        beg: cylinder  300, head  12, sector 14
        end: cylinder 1023, head  15, sector 63
3: <UNUSED>

The first entry is for the Linux partition, and is enough to hold a few
different kernel images as I wanted to try out different builds.  You
could make this smaller, but do bear in mind that each kernel is
around 1MB in size once gzip -9 has been applied to it (I think that
there is actually a Cobalt BIOS limit of 1MB - anyone care to confirm ?).

The next one I chose to be swap, mainly because that's what I'm used to
from Solaris.  The final entry is the rest of the drive - even if you
want to have multiple partitions under NetBSD (ie: /, /var, /home etc)
you only need a single entry here.

After fdisk, you will need to add a NetBSD disklabel.  This is where
you tell NetBSD where to find the mount points for the FFS partitions
that it uses.  It's also where I started to go wrong the first few
times of trying this.  Here's my current label:

type: ESDI
disk: FUJITSU MPD3173A
label: fictitious
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 16383
total sectors: 33793232
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

16 partitions:
#        size    offset     fstype  [fsize bsize cpg/sgs]
 a:  33490063    303169     4.2BSD   1024  8192    16   # (Cyl.  300*- 33525*)
 b:    262144     41024       swap                      # (Cyl.   40*- 300*)
 c:  33793232         0     unused      0     0         # (Cyl.    0 - 33525*)
 e:     40960        63 Linux Ext2      0     0         # (Cyl.    0*- 40*

I have chosen to have one big partition, and I have called it a.  If you
choose to do the same, make sure that this entry is the same size as the
third partition in fdisk.  If you want more than one NetBSD partition,
make sure you calculate all of them in relation to the size of that 3rd
fdisk slice, and not the size of the hard drive in total.

The swap and linux partitions should also be sized correctly for you -
to help follow the instructions on the Cobalt FAQ, I made the Linux
partition e.

Next, you need to format the partitions that you have just made, so
I then did a newfs on /dev/wd0a and that gave me a valid NetBSD disc
to mount.  I then downloaded from a local mirror the .tgz files that
I wanted for my system - you don't *need* all of these, but do read
the docs for yourself:

MD5.kernel
MD5.sets
base.tgz
comp.tgz
etc.tgz
man.tgz
misc.tgz
netbsd-GENERIC.gz
pkgsrc.tar.gz
src.tgz
syssrc.tgz
text.tgz

I actually downloaded them to the newly formatted /dev/wd0a - I used
mount /dev/wd0a /mnt and then created the directory /mnt/dload so
that once I had booted my Qube I still had all the sets present.  I
didn't bother installing anything other than base.tgz, etc.tgz and
the kernel, and then doing MAKEDEV (all in the Cobalt FAQ) - the
other sets were expanded on the Qube itself after I had booted the
system.

The only tricky part was getting the Linux partition formatted -
it must, *MUST* be formatted in the 'old' ext2 format without
any of the extra features that more recent Linux systems tend to
use.  Unfortunately, the NetBSD image I booted didn't have any
ext2fs tools, so I used an old RedHat 6.1 install CD and then
broke out of the installation to a command promt in order to
format the partition.  I would seriously not recommend this at
all - it was horrid.  I have just read about Knoppix, and I intend
to try this at some point but it should be able to do the trick.

You must format /dev/wd0e with the right command line, but I
don't have a Linux machine handy to tell you what this would be
- I'll try to get more infor on this step.

Once you have done this, I then booted the NetBSD CD-ROM again and
mounted both /dev/wd0a and /dev/wd0e and copied the kernel images
over to the correct place (again, all in the NetBSD Cobalt FAQ).

That was pretty much it - I then booted with the PC connected
to the serial console, and continued with the NetBSD config after
it came up single user.  If you feel like it, there is no reason
not to configure the Qube whilst the drive is mounted on the
PC.  Just edit /mnt/etc/rc.conf and the rest to suit - it's
entirely possible to add in sshd which will let you boot the
Qube up and continue the install via the network rather than
using the serial port.

So, is this of any use ?  If so, I'll refine it, add a few more
explicit command lines and give a simple numbered step-by-step.
This is just a rough guide from memory.  I will be doing it all
again in a few months, once I've saved up enough money for a 120GB
hard drive :)

TTFN,
-- 
ian.