From owner-freebsd-questions@FreeBSD.ORG Wed Jul 23 02:15:33 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C59EC460 for ; Wed, 23 Jul 2014 02:15:33 +0000 (UTC) Received: from wonkity.com (wonkity.com [67.158.26.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "wonkity.com", Issuer "wonkity.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 73672207B for ; Wed, 23 Jul 2014 02:15:33 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.9/8.14.9) with ESMTP id s6N2FRN1030207 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 22 Jul 2014 20:15:27 -0600 (MDT) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.9/8.14.9/Submit) with ESMTP id s6N2FRbG030204; Tue, 22 Jul 2014 20:15:27 -0600 (MDT) (envelope-from wblock@wonkity.com) Date: Tue, 22 Jul 2014 20:15:27 -0600 (MDT) From: Warren Block To: Polytropon Subject: Re: How much swap space for a 32 GB RAM system? In-Reply-To: <20140723032002.2a34a6b1.freebsd@edvax.de> Message-ID: References: <53CE8BB8.7030303@qeng-ho.org> <20140722191548.e3945a1e.freebsd@edvax.de> <20140723032002.2a34a6b1.freebsd@edvax.de> User-Agent: Alpine 2.11 (BSF 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (wonkity.com [127.0.0.1]); Tue, 22 Jul 2014 20:15:27 -0600 (MDT) 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 02:15:33 -0000 On Wed, 23 Jul 2014, Polytropon wrote: > 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? It's not necessary to recreate the swap file on every boot, or manually add it as swap or remove it as swap. Although there were some bugs with the 9.X /etc/rc.d/swapfile, it normally just required some entries in /etc/rc.conf. The swap file path, for example. >>> 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... In 10.0, Hiroki Sato set it up to do it all from /etc/fstab, and added a bunch of examples to fstab(5). Here is my entry for a swap file: md99 none swap sw,file=/usr/swap/swap 0 0 That's all. Well, the swap file has to be created before the first use. md99 is used to avoid having md0 tied up for a swap file when I want to mount an ISO.