Using mdconfig for swap space

Adam Vande More amvandemore at
Tue Sep 8 23:02:37 UTC 2009

On Tue, Sep 8, 2009 at 4:51 PM, Peter Steele <psteele at> 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?
> In general, this is not a good idea.  Your system will ideally not use swap
space at all, and if it's using it a lot then it could sure use the extra
ram consumed by the md drive instead of in swap.  Most likely to slow your
system down, not speed it up.  If you're going to do anything, it's best to
keep swap on a separate disk, or on the outer part of disk.

Adam Vande More

More information about the freebsd-questions mailing list