Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Dec 2004 12:15:22 +0000
From:      Daniel Bye <freebsd-questions@slightlystrange.org>
To:        FreeBSD Questions <questions@freebsd.org>
Subject:   Re: swapfile
Message-ID:  <20041214121522.GA57285@catflap.slightlystrange.org>
In-Reply-To: <7cbadc870412140035443ba967@mail.gmail.com>
References:  <7cbadc870412140035443ba967@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--gKMricLos+KVdGMg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Dec 14, 2004 at 10:35:49AM +0200, Nelis Lamprecht wrote:
> Hi,
>=20
> Checked the manual but couldn't find anything regarding this. If you
> have created more than one swap file how do you specify them in your
> rc.conf file ? Manually it works fine but obviously when the machine
> boots I want them both to be used again.
>=20
> swapfile=3D"/mailstore/swap1"
> swapfile=3D"/mailstore/swap2"
>=20
> The above doesn't work, only the first one is used.

The rc script seems to be written to only allow for one additional
swapfile.  It should be trivial to rewrite to handle multiple files

This diff should apply to /etc/rc.d/addswap to make your setup work.

--- /etc/rc.d/addswap   Tue Dec 14 12:08:41 2004
+++ addswap     Tue Dec 14 12:06:42 2004
@@ -22,10 +22,13 @@
        [Nn][Oo] | '')
                ;;
        *)
-               if [ -w "${swapfile}" -a -c /dev/mdctl ]; then
-                       echo "Adding ${swapfile} as additional swap"
-                       mdev=3D`mdconfig -a -t vnode -f ${swapfile}` && swa=
pon /dev/${mdev}
+            for sfile in ${swapfile} ]
+            do
+               if [ -w "${sfile}" -a -c /dev/mdctl ]; then
+                       echo "Adding ${sfile} as additional swap"
+                       mdev=3D`mdconfig -a -t vnode -f ${sfile}` && swapon=
 /dev/${mdev}
                fi
+            done
                ;;
        esac
 }


Keep a copy of the original addswap somewhere!  You will need to specify
both swapfiles in the same declaration:

swapfile=3D"/mailstore/swap1 /mailstore/swap2"

I have only done very basic testing, but it seems to work as you'd
expect.  However, I hereby disclaim any liability...  ;-)

HTH

Dan

--=20
Daniel Bye

PGP Key: ftp://ftp.slightlystrange.org/pgpkey/dan.asc
PGP Key fingerprint: 3B9D 8BBB EB03 BA83 5DB4 3B88 86FC F03A 90A1 BE8F
                                                                     _
                                              ASCII ribbon campaign ( )
                                         - against HTML, vCards and  X
                                - proprietary attachments in e-mail / \

--gKMricLos+KVdGMg
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (FreeBSD)

iD8DBQFBvtlZhvzwOpChvo8RAvFQAJ4voqtbd8dIPgV0DSvLKDEzK7fPfgCguHHM
xVHEoJKudy7TfnURglXtvF4=
=xw+f
-----END PGP SIGNATURE-----

--gKMricLos+KVdGMg--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041214121522.GA57285>