Using mdconfig for swap space

Peter Steele psteele at
Wed Sep 9 13:07:52 UTC 2009

Thanks for the responses. The reason I'm looking at doing this is that we have increased memory on our platform from 4GB to 8GB and therefore have to increase swap space from 8GB to 16GB. We have enough space in our /var partition that we could add a swap file there and not have to touch the existing partition layout. I like the simplicity of the swap file approach, but we have an application that is very sensitive to I/O performance and I'm a little wary what this could mean. QA I know would have a field day in trying to pound the system with all sorts of stress tests. I think a dedicated swap partition is probably a safer option.


-----Original Message-----
From: owner-freebsd-questions at [mailto:owner-freebsd-questions at] On Behalf Of Daniel Bye
Sent: Wednesday, September 09, 2009 3:57 AM
To: 'freebsd-questions at'
Subject: Re: Using mdconfig for swap space

On Tue, Sep 08, 2009 at 07:52:59PM -0400, Jerry McAllister wrote:
> On Tue, Sep 08, 2009 at 04:51:20PM -0500, 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:
> Unless I am missing something basic here, it seems like a bad idea to 
> me - to carve out and use up some memory to use as extra storage for 
> processes that need more memory that you have taken away to give to swap.
> That is self defeating.
> In addition, one use of swap is to write dumps to if there is a crash. 
> If you put it in memory, it is gone when you reboot.

He's talking about using a swap file, rather than a dedicated partition on the disk, not in RAM! Although it is slightly slower, as Chuck has already pointed out, it might, in certain circumstances, be a somewhat more convenient solution than repartitioning/reinstalling the whole system.

And as RW has said, the facility already exists and can be enabled with a couple of knobs in /etc/rc.conf.


Daniel Bye
                                              ASCII ribbon campaign ( )
                                         - against HTML, vCards and  X
                                - proprietary attachments in e-mail / \

More information about the freebsd-questions mailing list