Subject: Re: /tmp in swap
To: NetBSD/sparc <port-sparc@netbsd.org>
From: None <salvage@plethora.net>
List: port-sparc
Date: 12/25/2000 17:05:20
On "Mon, 25 Dec 2000 13:40:17 -0800", Greywolf <greywolf@starwolf.com> wrote:

>On Mon, 25 Dec 2000 salvage@plethora.net wrote:
>
># On "Mon, 25 Dec 2000 15:39:45 +1100", "Jenkins, Graham K [IBM GSA]" <Graham.
>K.Jenkins@team.telstra.com> wrote:
># 
># >Guys (and others) - I have been playing with memory filesystems
># >to place /tmp in swap space.  The examples in /etc/fstab.sd show:
># >  /dev/sd0b /tmp mfs rw,-s=20000  0 0
># >
># >That's OK - but what if you have multiple swap partitions and
># >wish to spread /tmp over all of them?  Perhaps ..
># >  swap      /tmp mfs rw,-s=20000  0 0  ??
># 
># I'm not 100% familiar with mfs, but I don't think that's an option.  I
># think that calls for some RAID functionality, and I don't recall seeing
># that in the source for 'mount_mfs'.
># 
># Specifying 'swap' as the base device pulls up defaults based on the
># primary swap partition.
>
>What if there is no "primary swap partition", i.e. nothing is compiled
>in and you have more than one swap partition mounted at equal priority?

I took "primary" from the man page which is in this case a bit
misleading.  What happens if the base device is 'swap', is that
a disklabel is made up on the spot for an imaginary 8 Mbyte
partition, and the whole shebang is built in memory.

>I would think that swap is treated as a chunk, as opposed to being split
>out into the respective devices of which it is composed, unless, of course,
>you assign different priorities to different devices.

Probably.  I got a similar comment from someone else, and I'm not
an expert on the detailed mechanics of swap.  So, "assume swap is
a chunk...".

># >And what if you leave out '-s=20000'?  Depending on OS version
># >it seems that half memory size - or half total swap - is assigned?
># 
># ISTR that it depends on whether you specify 'swap' as the base device
># or explicitly provide the "/dev/partition".  The default default is
># 16384 blocks --- 8 Mbytes.  I think if you explicitly provide the
># "/dev/partition" it will read the label and use the size of that.
># (Somebody correct me here if I'm imagining things.)
>
>I'm not sure what you mean by /dev/partition, here.  Do you mean
>"/dev/$overlap" where overlap=[some-disk]d for i386 and [some-disk]c for
>most others?

More like "/dev/sd0b" or "/dev/wd0b" or
"/dev/<disk-type>d<drive-number>b", as is traditional for swap.

Anyway, a quick experiment on this box with
`mount -t mfs /dev/sd0b /mnt` where "/dev/sd0b" is 512 Mbytes,
yielded a 256 Mbyte mfs, so I think there's some adjustment
factor I missed.
-- 
T. M. Pederson <salvage@plethora.net>
PGP key fingerprint = 48 94 7A 54 59 B6 C0 77  1F F6 94 55 0C 55 51 C4
"...and so the moral of the story is: Always make backups."
"But that was the moral last night, and the night before that too!"