From owner-freebsd-questions@FreeBSD.ORG Tue Sep 8 23:00:27 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 971F81065679 for ; Tue, 8 Sep 2009 23:00:27 +0000 (UTC) (envelope-from cswiger@mac.com) Received: from asmtpout019.mac.com (asmtpout019.mac.com [17.148.16.94]) by mx1.freebsd.org (Postfix) with ESMTP id 84D108FC12 for ; Tue, 8 Sep 2009 23:00:27 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Received: from cswiger1.apple.com ([17.227.140.124]) by asmtp019.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0KPO00LDFD8J9M20@asmtp019.mac.com> for freebsd-questions@freebsd.org; Tue, 08 Sep 2009 16:00:19 -0700 (PDT) Message-id: <7EDDD18F-A0BA-4BFF-8C98-FC6D38187B9E@mac.com> From: Chuck Swiger To: Peter Steele In-reply-to: <7B9397B189EB6E46A5EE7B4C8A4BB7CB3037EBB7@MBX03.exg5.exghost.com> Date: Tue, 08 Sep 2009 16:00:19 -0700 References: <7B9397B189EB6E46A5EE7B4C8A4BB7CB3037EBB7@MBX03.exg5.exghost.com> X-Mailer: Apple Mail (2.936) Cc: "'freebsd-questions@freebsd.org'" Subject: Re: Using mdconfig for swap space X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 23:00:27 -0000 Hi, Peter-- On Sep 8, 2009, at 2:51 PM, Peter Steele wrote: > Are there any advantages to using mdconfig and creating a virtual > disk for swap space as opposed to having a designated swap > partition? For example, I could do something like this: > > mdconfig -a -t swap -f /var/swap0 -s 4g > swapon -a /dev/md0 > > to add 4G to the system swap space backed by the file /var/swap0. > How would this compare to repartitioning my hard drive and adding a > new 4GB swap partition? First, using -f means using -t vnode. Secondly, swapping directly to a swap partition is mildly faster than having to navigate through the filesystem layers to do swapfile based swapping. Other platforms have chosen to go with the dynamically created and deleted swapfiles (under /var/vm/swapfile0, 1, etc for example) to allow the system to adjust the amount of disk used for swapspace dynamically. With disk space costing a matter of a few cents per gigabyte nowadays, setting up a dedicated swap partition and just letting it do it's thing is much easier than trying to fiddle around with alternatives, IMHO, but you're welcome to experiment and see whether you end up with something which is actually better for your circumstances.... Regards, -- -Chuck