From: Simon <turner25@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Any experience with swapfiles?
Date: Wed, 2 May 2012 16:58:22 -0400 [thread overview]
Message-ID: <CAN1q39V61HVcY=dXSXyOCWhn-vLk7WzVVtWL6FgQsMO47UDw0Q@mail.gmail.com> (raw)
In-Reply-To: <jnrvrl$57h$1@dough.gmane.org>
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=/dev/zero of=/path/to/swapfile bs=1M count=1024
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 <w41ter@gmail.com> 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? Security holes?
> Any horror stories out there?
>
>
next prev parent reply other threads:[~2012-05-02 21:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-02 18:53 [gentoo-user] Any experience with swapfiles? walt
2012-05-02 20:31 ` Paul Hartman
2012-05-02 20:33 ` Paul Hartman
2012-05-02 20:58 ` Simon [this message]
2012-05-02 21:50 ` [gentoo-user] " walt
2012-05-02 22:02 ` Paul Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAN1q39V61HVcY=dXSXyOCWhn-vLk7WzVVtWL6FgQsMO47UDw0Q@mail.gmail.com' \
--to=turner25@gmail.com \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox