Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Jul 2014 03:20:02 +0200
From:      Polytropon <freebsd@edvax.de>
To:        Warren Block <wblock@wonkity.com>
Cc:        FreeBSD-Questions <freebsd-questions@freebsd.org>
Subject:   Re: How much swap space for a 32 GB RAM system?
Message-ID:  <20140723032002.2a34a6b1.freebsd@edvax.de>
In-Reply-To: <alpine.BSF.2.11.1407221119110.80885@wonkity.com>
References:  <53CE8BB8.7030303@qeng-ho.org> <20140722191548.e3945a1e.freebsd@edvax.de> <alpine.BSF.2.11.1407221119110.80885@wonkity.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 22 Jul 2014 11:22:07 -0600 (MDT), Warren Block wrote:
> On Tue, 22 Jul 2014, Polytropon wrote:
> 
> > On Tue, 22 Jul 2014 17:05:12 +0100, Arthur Chance wrote:
> >> I'm getting a new machine with 32 GB of memory. The old "twice physical
> >> memory" sizing seems ridiculous, so how big should I make swap? Do I
> >> even need swap with this much memory?
> >
> > Need? Probably not, but you _never_ know... So preparing
> > a file-backed swap could be a nice solution: you do not
> > have to dedicate a fixed size partition for swap, and
> > depending on your disk setup (maybe SSD?) the speed (_if_
> > it gets in use) will be good enough. In order to do this,
> > you use dd to create a sparse file,
> 
> File yes, sparse file no.  Bad Things(TM) may happen with a sparse file.

Okay, probably wrong terminology here. :-)

This is how I did it: In order to keep things simple, I added
the following to /etc/rc.local:

	SWAP="/swapfile.tmp"
	/bin/rm -f $SWAP
	/bin/dd if=/dev/zero of=$SWAP bs=16m seek=1k count=0
	/sbin/mdconfig -a -t vnode -u 0 -f $SWAP || /bin/sh
	/bin/chflags nodump $SWAP
	/sbin/swapctl -a $SWAP

And /etc/rc.shutdown.local cleans it up:

	/sbin/swapctl -d /dev/md0
	/sbin/mdconfig -d -u 0

Suggestions for improvement?



> > configure it as a
> > memory disk, and enable it with swapctl.
> 
> In 10.x, this can be done in /etc/fstab.

This is on (or for) 10.0, how exactly does it work, which options
are involved? Note that the above method has been "invented" for
the use with SSDs in FreeBSD 8 and 9, so possibly it's easier to
do something similar in FreeBSD 10...


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



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