[comp.sys.next] A few minor prob left...

cyliao@hardy.u.washington.edu (Chun-Yao Liao) (10/12/90)

	Hi, I was almost succesful instaling the Wren IV to my CuBE! except
	I have a little trouble here.

	During the boot up process, these following line were displayed
	on the screen (verbose mode)
	
	checking disks:
	/dev/sd0a: file system clean: skipping check
	/dev/rsd0b: file system clean : skiping check
	    ^^^
	how comes that it uses /dev/rsdob instead of /dev/sd0b?
	(ps, these line sare from memory)

	Then this

	/usr/etc/mach-swapon: swapping on /Candy/vm/swapfile
		(this line is all right)
	mach_swapon : mach_swapon failed : error 0
	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

	What does this mean?
	Now I am running the system from the HD already, but there are
	a few strange behaviors with swapfile. The swapfile gets something
	about 17 megs right after I run the terminal right after I login
	to my own account, me. Can any one help me to fix this out?

my fstab
/dev/sd0a / 		4.3 rw,noquota,noauto 0 1
/dev/sd0b /Candy	4.3 rw,noquota,noauto 0 2

my swaptab
/Candy/vm/swapfile     lowat=20971520	# 20 Meg low water mark

my rc.swap

#
# This script mounts and initializes the internal swapdisk which we mount
# on /tmp.
#
NEWSWAPPART=/Candy
NEWSWAPDIR=$NEWSWAPPART/vm
NEWSWAPFILE=$NEWSWAPDIR/swapfile

# Find out which device to check.
SWAPDEV=`grep $NEWSWAPPART /etc/fstab | awk '{print $1}' \
	| sed -e 's/\/dev\///'`

# Check for the swapdisk
if [ -z "$SWAPDEV" ]
then
	exit 0
fi

#---------------------------
useswap=0
if [ $lx=autobootx ]
then
	/usr/etc/fsck -p /dev/r${SWAPDEV} && useswap=1 >/dev/console 2>&1
else
	useswap=1
fi
#==========================

# We have a swap disk, set things up to use it.
if [ $useswap -eq 1 ]
then
	# Mount the swapdisk
	/usr/etc/mount $NEWSWAPPART		>/dev/console 2>&1

	# Set up swapping on it
	if [ ! -d $NEWSWAPDIR ]
	then
		(echo "Creating vm directory on swapdisk")	>/dev/console
		mkdir $NEWSWAPDIR
		chmod 755 $NEWSWAPDIR
	fi
	if [ ! -f $NEWSWAPFILE ]
	then
		(echo "Creating swapfile on swapdisk")		>/dev/console
		touch $NEWSWAPFILE
		chmod 1600 $NEWSWAPFILE
	fi
	/usr/etc/mach_swapon -v -o prefer,lowat=16777216 $NEWSWAPFILE	>/dev/console 2>&1

	# Make sure there is a tmp directory
	if [ ! -d $NEWSWAPPART/tmp ]
	then
		(echo "Creating tmp directory on swapdisk")	>/dev/console
		mkdir $NEWSWAPPART/tmp
		chmod 1777 $NEWSWAPPART/tmp
	fi

	# Point /private/tmp to it
	if [ ! -h /private/tmp ]
	then
		(echo "Linking /private/tmp to $NEWSWAPPART/tmp") \
								>/dev/console
		rm -rf /private/tmp
		(cd /private; ln -s $NEWSWAPPART/tmp)
	fi
else
	# Make sure /private/tmp is a directory
	if [ ! -d /private/tmp ]
	then
		(echo "Creating /private/tmp directory")	>/dev/console
		rm -f /private/tmp
		mkdir /private/tmp
		chmod 1777 /private/tmp
	fi
fi


Thanx for spending all these time following these files! :-)

cyliao@wam.umd.edu     		o NeXT :  I put main frame power on two chips.
      @epsl.umd.edu		o people: We put main flame power on two guys.
      @bagend.eng.umd.edu       o ::::::::::::::::::::::::::::::::::::::::::::
 xxxxx@xxxxx.xxx.xxx (reserved)	o RC + Apple // + Classic Music + NeXT = cyliao

tgoldtho@ccng.waterloo.edu (Thomas A. Goldthorpe) (10/15/90)

In article <9102@milton.u.washington.edu> cyliao@hardy.acs.washington.edu (Chun-Yao Liao) writes:
>
>	/usr/etc/mach-swapon: swapping on /Candy/vm/swapfile
>		(this line is all right)
>	mach_swapon : mach_swapon failed : error 0
>	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You are not supposed to modify the rc scripts or the file
/etc/swaptab to mount a disk for the swapfile.  See below for
quick details and what to do: 

Explaination:  (a real quickie)

On start up, the rc script checks all disk labels.  When it finds one that
says 'swapdisk', it checks the fstab file for an entry with 'swapdisk' in it.
If it finds the entry, it knows which partition to mount from that entry
to /private.  The script itself mounts the partition and then creates the
file /private/swapdisk/vm/swapfile (I'm not on a NeXT at the moment, and
my memory is not the greatest for names, hence that path may be slightly
wrong).  Anyway, it also links /tmp into that mounted disk at the same
point then continues on.  The explicit mount in the rc script is OK, since
the fstab entry specifies the partition shouldn't be mounted via normal
standards.  In summary, all you need to do is specify the label on the
disk with the partition to mount is 'swapdisk', and that an entry which
won't mount the disk (but has the correct info for the partition and the
name swapdisk) appears in /etc/fstab.  (Note, /etc/fstab is really a link
with /private/etc/fstab, just like most other things :-)

That was a QUICK explaination, and it is 1:00 in the morning, and hence
not too coherent (I need real sleep soon).

Mail me if you have problems.

Tom

rca@cs.brown.edu (Ronald C.F. Antony) (10/18/90)

In article <1990Oct15.050058.27579@ccng.waterloo.edu>, tgoldtho@ccng.waterloo.edu (Thomas A. Goldthorpe) writes:
|> In article <9102@milton.u.washington.edu> cyliao@hardy.acs.washington.edu (Chun-Yao Liao) writes:
|> >
|> >	/usr/etc/mach-swapon: swapping on /Candy/vm/swapfile
|> >		(this line is all right)
|> >	mach_swapon : mach_swapon failed : error 0
|> >	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|> 
|> You are not supposed to modify the rc scripts or the file
|> /etc/swaptab to mount a disk for the swapfile.  See below for
|> quick details and what to do: 

CORRECT


|> On start up, the rc script checks all disk labels.  When it finds one that
|> says 'swapdisk', it checks the fstab file for an entry with 'swapdisk' in it.
|> If it finds the entry, it knows which partition to mount from that entry
|> to /private.  The script itself mounts the partition and then creates the
|> file /private/swapdisk/vm/swapfile (I'm not on a NeXT at the moment, and
|> my memory is not the greatest for names, hence that path may be slightly
|> wrong).  Anyway, it also links /tmp into that mounted disk at the same
|> point then continues on.  The explicit mount in the rc script is OK, since
|> the fstab entry specifies the partition shouldn't be mounted via normal
|> standards.  In summary, all you need to do is specify the label on the
|> disk with the partition to mount is 'swapdisk', and that an entry which
|> won't mount the disk (but has the correct info for the partition and the
|> name swapdisk) appears in /etc/fstab.  (Note, /etc/fstab is really a link
|> with /private/etc/fstab, just like most other things :-)

Actually he should do the following:
a) As NeXT has a swapfile and not a swap disk, the second partition should NOT
be used as swappartition at all. The point of having a swapfile is that it 
can grow and shrink (after a reboot) according to the demand and within the
bounds of the size of the filesystem. By using a swap partition, you get rid
of this advantage. The whole thing with the swapdisk-label was invented for
OD-only systems with the 40MB drive to speed up swapping.
b) The second partition you usually find on bigger NeXT hard drives is there
to mount network clients. If you have a standalone system, get rid of it and
make your main file system bigger. This saves a lot of trouble with allocating
files to filesytems and such 
c) Don't modify the scripts written by NeXT. They do everything automatically.
They look for a swapdisk, and if they don't find it, create the standard swap
file we want to have.

Ronald
------------------------------------------------------------------------------
"The reasonable man adapts himself to the world; the unreasonable one persists
in trying to adapt the world to himself. Therefore all progress depends on the
unreasonable man."  Bernhard Shaw | rca@cs.brown.edu or antony@browncog.bitnet
------------------------------------------------------------------------------
SUN: rca@cs.brown.edu / rca@brunix.uucp / rca@browncs.bitnet
NeXT: rcfa@next.cis.brown.edu
CogSciVAX: antony@cogsci.cog.brown.edu / antony@browncog.bitnet
BROWNvm: st502509@brownvm.brown.edu / st502509@brownvm.bitnet
HSGvax: antony@unisg.ch / antony@csghsg5a.earn 
HSG-HP: ronald@aetna.unisg.ch
UNIGS-UNIX: ant@unigs.uucp
------------------------------------------------------------------------------

tgoldtho@ccng.waterloo.edu (Thomas A. Goldthorpe) (10/18/90)

In article <53614@brunix.UUCP> rca@cs.brown.edu (Ronald C.F. Antony) writes:
>a) As NeXT has a swapfile and not a swap disk, the second partition should NOT
>be used as swappartition at all.

Did I say to use the second partition of his main disk as swap?  No.

>The point of having a swapfile is that it 
>can grow and shrink (after a reboot) according to the demand and within the
>bounds of the size of the filesystem. By using a swap partition, you get rid
>of this advantage.

What advantage?  You can place your swapfile anywhere.  It will still have
that dynamic characteristic.  If it runs out of space, swapon allows for other
swap files in other partitions to be used anyway.  On a single hard disk
system, of course the only swapfile will be the one created.  On a multiple
hard disk system, there are advantages to having the primary swapfile on
another disk along with /tmp.

>b) The second partition you usually find on bigger NeXT hard drives is there
>to mount network clients. If you have a standalone system, get rid of it and
>make your main file system bigger. This saves a lot of trouble with allocating
>files to filesytems and such 

I agree with making one large partiton, but you are forgetting that you are
suggesting this to some people on the net who haven't the slightest idea how to
go about doing this (or for that matter the amount of time involved in the
backup).  

>c) Don't modify the scripts written by NeXT. They do everything automatically.
>They look for a swapdisk, and if they don't find it, create the standard swap
>file we want to have.

I thought I already said this.

smithw@hamblin.math.byu.edu (William V. Smith) (10/18/90)

Thomas A. Goldthorpe < tgoldtho@ccng.waterloo.edu> writes:
>that dynamic characteristic.  If it runs out of space, swapon allows for other
>swap files in other partitions to be used anyway.  On a single hard disk
>system, of course the only swapfile will be the one created.  On a multiple
>hard disk system, there are advantages to having the primary swapfile on
>another disk along with /tmp.

There is a bug (in 1.0 at least) which can cause problems if you have
multiple swapfiles. When one fills, the vm system doesn't seem to always
know that it should not write part of a page to one and part to another.
It then seems to lose track of things and . . . PANIC>  
This happened to me a couple of times before I figured out what to do
about build.660 putting in  references to two partitions. Then I 
rebuilt my disk and now no problems with vm.  This is an annoying bit
though.  It would be nice to be able to make just a few changes and
then add another disk which you could swap to (in addition to the boot
device say) or mount some remote disk partition down the hall as an
overflow if necessary, etc.  Anyone know if this is fixed in 2.0?

-Bill-

dorner@pequod.cso.uiuc.edu (Steve Dorner) (10/18/90)

In article <53614@brunix.UUCP> rca@cs.brown.edu (Ronald C.F. Antony) writes:
>b) The second partition you usually find on bigger NeXT hard drives is there
>to mount network clients. If you have a standalone system, get rid of it and
>make your main file system bigger. This saves a lot of trouble with allocating
>files to filesytems and such 

There ain't no such thing as a free lunch, and either way you go there
can be problems.

Parititions can be very handy for isolating obnoxious users of disk space.
With a one-partition system, a single errant process can swallow ALL the
disk space.

Lest you think this an esoteric consideration, let me tell you what happened
on my single-partition 330 last weekend.

I keep some private libraries, and re-index them automatically at night.  Well,
one night the index process burped, and swallowed all disk on the machine.
Major disaster time, because /private/vm/swapfile couldn't grow when it
wanted to, and all sorts of things failed in all sorts of interesting ways.

I'm thinking strongly about partitioning my 330, and putting the swapfile
on a partition with only "well-behaved" things.  This would waste some disk
space, and would limit my swapfile size, but it also would protect me
from disasters like the above. 
--
Steve Dorner, U of Illinois Computing Services Office
Internet: s-dorner@uiuc.edu  UUCP: uunet!uiucuxc!uiuc.edu!s-dorner

cpenrose@sdcc13.ucsd.edu (Christopher Penrose) (10/18/90)

In article <1990Oct18.155648.27681@ux1.cso.uiuc.edu> dorner@pequod.cso.uiuc.edu (Steve Dorner) writes:

>Parititions can be very handy for isolating obnoxious users of disk space.
>With a one-partition system, a single errant process can swallow ALL the
>disk space.

You can limit swap space on a single partition system by including a 
hi-water mark for your swapfile.  I have done this.  I sometimes I have the
need for large amounts of swap space (lisp, soundfile editting); however,
I also need the flexibility of recovering this disk space for other
purposes.  The hi-water mark is an absolute threshold for swap space 
that can be added to the /private/etc/swaptab file.

/private/vm/swapfile	lowat=20971520 hiwat=50000000

Also, if you are thinking of partitioning your drive, you can instead
try this:

/private/vm/swapfile	lowat=50000000 hiwat=50000000

This will create a large static swapfile during boot-up and you can reduce
or increase the size later if needed without repartitioning your drive.  I
think that this almost constitutes a free lunch.


Christopher Penrose
{seismo.css.gov,ucsd.edu}!esosun!jesus!penrose
cpenrose@ucsd.edu

rca@cs.brown.edu (Ronald C.F. Antony) (10/18/90)

In article <1990Oct17.231958.10800@ccng.waterloo.edu>, tgoldtho@ccng.waterloo.edu (Thomas A. Goldthorpe) writes:
|> In article <53614@brunix.UUCP> rca@cs.brown.edu (Ronald C.F. Antony) writes:
|> >The point of having a swapfile is that it 
|> >can grow and shrink (after a reboot) according to the demand and within the
|> >bounds of the size of the filesystem. By using a swap partition, you get rid
|> >of this advantage.
|> 
|> What advantage?  You can place your swapfile anywhere.  It will still have
|> that dynamic characteristic.  If it runs out of space, swapon allows for other
|> swap files in other partitions to be used anyway. 
The point is, that if you want multiple swapfiles you have to install them 
manually. If you just have one in the standard configuration, then everything
works automatically and you don't have to bother about multiple swapfiles.
The main advantage of having one partition is that you don't have to think about
how much space you want to use for swap space, /tmp or other files. As soon as
you make partitions for other reasons than the /client that is used by NeXT, 
you have to think about these things.
The baseline: the closer you are with what you are doing with what NeXT intended
the less trouble there will be.

-- Ronald
------------------------------------------------------------------------------
"The reasonable man adapts himself to the world; the unreasonable one persists
in trying to adapt the world to himself. Therefore all progress depends on the
unreasonable man."  Bernhard Shaw | rca@cs.brown.edu or antony@browncog.bitnet
------------------------------------------------------------------------------