From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1SPgf5-0006Jq-7d for garchives@archives.gentoo.org; Wed, 02 May 2012 21:00:35 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 040D7E04D2; Wed, 2 May 2012 21:00:15 +0000 (UTC) Received: from mail-yx0-f181.google.com (mail-yx0-f181.google.com [209.85.213.181]) by pigeon.gentoo.org (Postfix) with ESMTP id BEFC2E0769 for ; Wed, 2 May 2012 20:58:22 +0000 (UTC) Received: by yenq2 with SMTP id q2so1446733yen.40 for ; Wed, 02 May 2012 13:58:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:content-type:content-transfer-encoding; bh=dnrL1F/2muEj2Sz2JFRohNMaRFf6sPnIT46INUNR4LA=; b=KzcTHftbo0aZVJ/BDchuy9xYckj6fW+wv5G4dNdIAwxBwxmRvthWkg93lptOW43n6Q seVOIHd9FZtzj67vZ/b1LvnOtgZDOvuzyXUc0tYLWiEwpbou7gwYznKqZOId/rwEillM LysCKIpSOFv6mm8x8l296HEyp//08AmVESsd4anuZTwBGL2HBMeMZotl9Ut3+grBkDbB 069PNMrW6MR1NJC9pHFVtJP57rpslLX8DhWdn/FzZsLTTuyIV63vjuoMd5sb5NkM98k2 /oEFud+LlKMk7vwL0+TZu3EotXsZ9PZBGSA0NGfSKGUaHAax64vxKdleaZ59jILjzXsF LiZg== Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Received: by 10.50.191.233 with SMTP id hb9mr6305888igc.44.1335992302216; Wed, 02 May 2012 13:58:22 -0700 (PDT) Received: by 10.231.205.193 with HTTP; Wed, 2 May 2012 13:58:22 -0700 (PDT) In-Reply-To: References: Date: Wed, 2 May 2012 16:58:22 -0400 Message-ID: Subject: Re: [gentoo-user] Any experience with swapfiles? From: Simon To: gentoo-user@lists.gentoo.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 2a029607-e5d3-42f5-8c14-0a8ddf7c7022 X-Archives-Hash: b7f1a3cd7b93291f253ee537e83c22fe I haven't used a swap partition on any of my systems (intel celeron, p3, amd64, intel xeon) for over... what... 10 years? Swapfiles only, and sometimes I don't even mount the swap. Although I have never removed support for any kind of swap from my kernel. dd if=3D/dev/zero of=3D/path/to/swapfile bs=3D1M count=3D1024 mkswap /path/to/swapfile swapon /path/to/swapfile (btw, I like to put the swap file in /root or /boot, but that's my pref, on space constrained PC, i would put a swapfile on every drive to distribute it). I don't have access to my box to confirm but I think /etc/fstab would be setup the same as normal swap except with the file path instead of the device partition. Except for issue pointed out by Paul about hibernation, dd line above takes care of non-sparsity. As for security, having a swap is less secure than having none: a malicious persion could extract information from programs memory which was swapped (ie, like the decripted information "for your eyes only"). Having no swap at all was a problem on small systems with little RAM when emerging big stuff (boost failed all the time on a pc with 256mb). Resizing swap "on-the-fly" with swapfiles: And on HDD-space constrained system, i used to have several swapfiles that I created and deleted in the manner above, that I named swapfile-256, swapfile-512, etc... A smooth "upgrade of swap on-the-fly" was done this way: say I had 256 swapped on, I could swap on a new 512 (768 total at moment, all data still on 256mb file), then swapoff the 256 (takes a bit of time for swap data to move over), delete the 256. Downgrade can be done in the same manner. "swapon -s" (status) will be a good friend of yours now. Good luck! Simon On Wed, May 2, 2012 at 2:53 PM, walt wrote: > I have two machines with 4GB of ram and I've never seen either one use > swapspace (yet) so I'm thinking I could delete my swap partitions and > substitute a much smaller swapfile -- if it's safe. > > Any downside to using a swap file instead of a swap partition, maybe > depending on which filesystem you use, or something? =A0Security holes? > Any horror stories out there? > >