Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 08 Sep 2009 16:00:19 -0700
From:      Chuck Swiger <cswiger@mac.com>
To:        Peter Steele <psteele@maxiscale.com>
Cc:        "'freebsd-questions@freebsd.org'" <freebsd-questions@freebsd.org>
Subject:   Re: Using mdconfig for swap space
Message-ID:  <7EDDD18F-A0BA-4BFF-8C98-FC6D38187B9E@mac.com>
In-Reply-To: <7B9397B189EB6E46A5EE7B4C8A4BB7CB3037EBB7@MBX03.exg5.exghost.com>
References:  <7B9397B189EB6E46A5EE7B4C8A4BB7CB3037EBB7@MBX03.exg5.exghost.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7EDDD18F-A0BA-4BFF-8C98-FC6D38187B9E>