Using mdconfig for swap space

Jerry McAllister jerrymc at msu.edu
Wed Sep 9 16:01:17 UTC 2009


On Wed, Sep 09, 2009 at 04:46:56PM +0100, Daniel Bye wrote:

> On Wed, Sep 09, 2009 at 10:59:23AM -0400, Jerry McAllister wrote:
> > On Wed, Sep 09, 2009 at 11:57:07AM +0100, Daniel Bye wrote:
> > 
> > > 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.
> > 
> > I understand using a file and making it in to swapspace.  I have used that
> > a couple of times when I needed to add some swap space temporarily.   But 
> > isn't the command he is trying to use (mdconfig) for creating a memory 
> > filesystem - eg use a chunk of memory and make a file from it (then use it 
> > for swap or whatever)?    That is in RAM.
> 
> No, with the -t vnode and -f <filename> options, he'd actually be creating
> a file-backed memory disk. The terminology can be a little confusing, but
> in this instance the file wouldn't be loaded into RAM, but would instead
> be treated as any other disk-like device. It's exactly the same approach
> as used by /etc/rc.d/addswap, which gets its configuration from $swapfile
> set in /etc/rc.conf.

I see that now, but it seems like the long way around to
get to what you get with a swapon.
Oh well.

////jerry


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




More information about the freebsd-questions mailing list