Subject: Re: problems with swap partition on 1.2 (SOLVED)
To: None <port-i386@netbsd.org>
From: Anne Bennett <anne@alcor.concordia.ca>
List: port-i386
Date: 11/17/1999 14:19:24
[Solved it!  See end of message...]

Brian C. Grayson <bgrayson@marvin.ece.utexas.edu> responds to my query:
>> 
>> Do you have any idea at all what might cause a 1.2 system booted on
>> sd0g to (a) try to savecore from sd0h instead of sd0b, and (b) claim
>> that sd0b is "not configured"?
> 
>   I seem to recall that earlier NetBSDs used to assume, in at
> least some locations, that the swap partition was root+1, i.e.,
> g+1 = h for your setup.  

Eeep.  As der Mouse mentioned separately, it was fortunate that I did
not actually have a filesystem on partition h!  Maybe?  Anyway...

> If you want to be sneaky, edit your
> disklabel and point sd0h to the same place as sd0b.

Good idea, but no go.  I tried it, and first of all, although the
disk label seems to be written as I request it, the disklabel command
complains:

  (stdin:)
  [...]
  7 partitions:
  #        size   offset    fstype   [fsize bsize   cpg]
    a:    73600        0    4.2BSD     1024  8192    16   # (Cyl.    0 - 79)
    b:   288880    73600      swap                        # (Cyl.   80 - 393)
    c:  6265200        0    unused        0     0         # (Cyl.    0 - 6809)
    d:  6265200        0    unused        0     0         # (Cyl.    0 - 6809)
    e:   161920   362480    4.2BSD     1024  8192    16   # (Cyl.  394 - 569)
    f:  4607360  1127920    4.2BSD     1024  8192    16   # (Cyl. 1226 - 6233)
    g:   529920  5735280    4.2BSD     1024  8192    16   # (Cyl. 6234 - 6809)

  (stderr:)
  disklabel: warning, unused partition h: size 288880 offset 73600

I gamely tried booting off sd0g anyway, but got the same errors as
before during boot (note that I had not changed fstab; it still points
to sd0b for swap):

  Nov 17 11:13:18 vindemiatrix /netbsd: changing root device to sd0g
  Nov 17 11:13:18 vindemiatrix /netbsd: WARNING: no swap space found
  Nov 17 11:13:13 vindemiatrix savecore: /dev/sd0h: Device not configured

Interestingly, though, one of the errors I get when trying to explicitly
add the swap space (after boot is complete) is different:

  # swapon -a
  swapon: /dev/sd0b: device not configured
  # swapon /dev/sd0h
  swapon: /dev/sd0h: device already in use

I can't find a swap statistics command, so I could not think of a way
to check whether there was any swap in use, though after "WARNING: no
swap space found", I assume not.  I don't know what it's going on about
when it tells me that sd0h is in use.

> Or, if you want to be a little bit nicer,

Nice, me?   >:-)  OK...

> rename sd0b to sd0h, and change
> your /etc/fstab on your 1.4.1 system to use swap on sd0h, not
> sd0b.  Or, split sd0b into two pieces, and call one sd0b and the
> other sd0h.

I tried the split (but again not the fstab mod), and again disklabel
complained:

  (stdin:)
  [...]
  7 partitions:
  #        size   offset    fstype   [fsize bsize   cpg]
    a:    73600        0    4.2BSD     1024  8192    16   # (Cyl.    0 - 79)
    b:   144440    73600      swap                        # (Cyl.   80 - 236)
    c:  6265200        0    unused        0     0         # (Cyl.    0 - 6809)
    d:  6265200        0    unused        0     0         # (Cyl.    0 - 6809)
    e:   161920   362480    4.2BSD     1024  8192    16   # (Cyl.  394 - 569)
    f:  4607360  1127920    4.2BSD     1024  8192    16   # (Cyl. 1226 - 6233)
    g:   529920  5735280    4.2BSD     1024  8192    16   # (Cyl. 6234 - 6809)

  (stderr:)
  disklabel: warning, unused partition h: size 144440 offset 218040

During boot I saw exactly the same behaviour as before, and when I
tried to add the swap later, I got the same errors as with sd0b=sd0h.

>   If you don't like any of those ideas, 

Well, I liked them well enough, but they didn't work. :-)

> you might be able to
> sidestep some problems by using a swapfile on sd0g, and no swap
> partition per se -- does 1.2 support swapping to files?  (I
> thought so, but can't remember for sure.)

"man swapon" and "apropos swap" don't indicate any such support.

>   I hope this helps...

It did, actually, in that it gave me several avenues of thought and
experiment.  (And gave me some moral support!)


I wondered if it was possible to build a kernel that would swap on the
"right" partition (the one I want it to use!) no matter where the root
partition is.  I always build kernels these days with something like:

  config          netbsd  swap generic

but I recalled that in the old SunOS 3 days we sometimes used to build
kernels with "root on foo swap on bar" instead of "swap generic".

I looked through the manpages for the syntax of that line in the
kernel configuration file under NetBSD, but --- ah, found it, in USENIX
and O'Reilly's 4.4BSD System Manager's Manual.  The syntax I want is:

  config          netbsd root on sd0g swap on sd0b

My first attempt to build this kernel (on another host, since I had
wiped out my sources from this machine) failed with:

  ld -z -Ttext F8100000 -e start -x -o netbsd ${SYSTEM_OBJ} vers.o
  autoconf.o: Undefined symbol `_setconf' referenced from text segment

But then, after looking at i386/autoconf.c, I removed "option GENERIC",
and I got a successful build.  OK, here goes nothing....

Hey, it works!  My workstation is up on the spare partition (sd0g), it
didn't complain about swapping, and I have X running with a dozen or
so xterms, each of which has an ssh client running, so there's a
normal load.  It all seems fine.  Yay!

Now I can go on to installing 1.4.1, and finding out what lovely new
features have been added. :-)

Thanks!


Anne.
-- 
Ms. Anne Bennett, Senior Analyst, IITS, Concordia University, Montreal H3G 1M8
anne@alcor.concordia.ca                                        +1 514 848-7606