From owner-freebsd-questions@FreeBSD.ORG Wed Jul 23 01:20:08 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 91F65C58 for ; Wed, 23 Jul 2014 01:20:08 +0000 (UTC) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 535C82C36 for ; Wed, 23 Jul 2014 01:20:07 +0000 (UTC) Received: from r56.edvax.de (port-92-195-69-249.dynamic.qsc.de [92.195.69.249]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx02.qsc.de (Postfix) with ESMTPS id B122E249AF; Wed, 23 Jul 2014 03:20:03 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id s6N1K2wi001927; Wed, 23 Jul 2014 03:20:02 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Wed, 23 Jul 2014 03:20:02 +0200 From: Polytropon To: Warren Block Subject: Re: How much swap space for a 32 GB RAM system? Message-Id: <20140723032002.2a34a6b1.freebsd@edvax.de> In-Reply-To: References: <53CE8BB8.7030303@qeng-ho.org> <20140722191548.e3945a1e.freebsd@edvax.de> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: FreeBSD-Questions X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jul 2014 01:20:08 -0000 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, ...