From owner-freebsd-questions@FreeBSD.ORG Wed Sep 9 15:48:12 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 62FDB106568D for ; Wed, 9 Sep 2009 15:48:12 +0000 (UTC) (envelope-from danielby@slightlystrange.org) Received: from mtaout01-winn.ispmail.ntl.com (mtaout01-winn.ispmail.ntl.com [81.103.221.47]) by mx1.freebsd.org (Postfix) with ESMTP id 391F38FC13 for ; Wed, 9 Sep 2009 15:48:10 +0000 (UTC) Received: from aamtaout01-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20090909154806.PQWZ6742.mtaout01-winn.ispmail.ntl.com@aamtaout01-winn.ispmail.ntl.com> for ; Wed, 9 Sep 2009 16:48:06 +0100 Received: from catflap.slightlystrange.org ([82.21.101.171]) by aamtaout01-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20090909154805.ENBA13254.aamtaout01-winn.ispmail.ntl.com@catflap.slightlystrange.org> for ; Wed, 9 Sep 2009 16:48:05 +0100 Received: by catflap.slightlystrange.org (Postfix, from userid 106) id 6FC78618A; Wed, 9 Sep 2009 16:48:03 +0100 (BST) Received: from torus.slightlystrange.org (torus.slightlystrange.org [10.1.3.50]) by catflap.slightlystrange.org (Postfix) with SMTP id E9A4C6152 for ; Wed, 9 Sep 2009 16:48:02 +0100 (BST) Received: by torus.slightlystrange.org (sSMTP sendmail emulation); Wed, 9 Sep 2009 16:46:56 +0100 From: "Daniel Bye" Date: Wed, 9 Sep 2009 16:46:56 +0100 To: "'freebsd-questions@freebsd.org'" Message-ID: <20090909154655.GA96342@torus.slightlystrange.org> Mail-Followup-To: "'freebsd-questions@freebsd.org'" References: <7B9397B189EB6E46A5EE7B4C8A4BB7CB3037EBB7@MBX03.exg5.exghost.com> <20090908235259.GB19173@gizmo.acns.msu.edu> <20090909105707.GA27941@torus.slightlystrange.org> <20090909145922.GB22253@gizmo.acns.msu.edu> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="pWyiEgJYm5f9v55/" Content-Disposition: inline In-Reply-To: <20090909145922.GB22253@gizmo.acns.msu.edu> User-Agent: Mutt/1.4.2.3i X-PGP-Fingerprint: D349 B109 0EB8 2554 4D75 B79A 8B17 F97C 1622 166A X-Operating-System: FreeBSD 8.0-BETA4 i386 X-Cloudmark-Analysis: v=1.0 c=1 a=ehNlctqhnw0A:10 a=sMXvUWEPgyZeitHrkAcA:9 a=FRX6FAx5bYe1A2sgC8o4aBBW2K0A:4 a=SS-wYJYrlrzQUmKJYOIA:9 a=uC404JyWWA3u93BEo9rG8eblYmsA:4 Subject: Re: Using mdconfig for swap space X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Bye List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2009 15:48:12 -0000 --pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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: >=20 > > 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: > > >=20 > > > > Are there any advantages to using mdconfig and creating a virtual d= isk for swap space as opposed to having a designated swap partition? For ex= ample, I could do something like this: > > >=20 > > > Unless I am missing something basic here, it seems like a bad idea to= =20 > > > me - to carve out and use up some memory to use as extra storage for= =20 > > > processes that need more memory that you have taken away to give to s= wap. =20 > > > That is self defeating. > > >=20 > > > In addition, one use of swap is to write dumps to if there is a crash= .=20 > > > If you put it in memory, it is gone when you reboot. > >=20 > > He's talking about using a swap file, rather than a dedicated partition= on=20 > > the disk, not in RAM! Although it is slightly slower, as Chuck has alre= ady=20 > > pointed out, it might, in certain circumstances, be a somewhat more=20 > > convenient solution than repartitioning/reinstalling the whole system. > >=20 > > And as RW has said, the facility already exists and can be enabled with= a > > couple of knobs in /etc/rc.conf. >=20 > 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= =20 > isn't the command he is trying to use (mdconfig) for creating a memory=20 > filesystem - eg use a chunk of memory and make a file from it (then use i= t=20 > for swap or whatever)? That is in RAM. No, with the -t vnode and -f 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. Dan --=20 Daniel Bye _ ASCII ribbon campaign ( ) - against HTML, vCards and X - proprietary attachments in e-mail / \ --pWyiEgJYm5f9v55/ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.13 (FreeBSD) iEYEARECAAYFAkqnze8ACgkQixf5fBYiFmpJ3QCgxzXZxts+fWGb+pk5wAsW1Q7b nOYAoNfjr3VxrKPcxWmOYhte4OBSS6jz =3F7l -----END PGP SIGNATURE----- --pWyiEgJYm5f9v55/--