[NCLUG] increasing swap space on the fly?

Mike Loseke mike at verinet.com
Mon Oct 29 11:17:28 MST 2001


Thus spake Daniel Herrington:
> A friend of mine sent me this question, and I don't know the answer.
> I'm also thinking about upgrading my memory, so I'm interested in the
> answer as well.
> 
> How can you increase the amount of swap space without killing your
> other partitions?  Is there a good "partition magic"-like program to
> use that will resize partitions on the fly?  I seem to recall
> something like cfdisk, or fips, or something.  But back when I was
> reading about it, it was pretty unreliable.

 You can do this without modifying partitions, or even adding partitions.
How, you ask? Files, my friend. :-)

 See the manpages for dd, mkswap and swapon (as well as fstab). Basically,
using dd you can create a file of whatever size you need, mkswap initializes
it and swapon adds it to the paging area. To make it permanent, mount it
as swap in fstab. You can also remove swap space using swapoff.

 Now, I've never done this in Linux but reading these manpages (especailly
mkswap) it looks like it works fine. I've done this numerous times in
Solaris (using mkfile, swap and dfstab) with great results.

-- 
   Mike Loseke    | The quantum nature of space and time must be dealt
 mike at verinet.com | with in a unified theory. At the shortest distance
                  | scales, space may be replaced by a continually
                  | reconnecting structure of strings and membranes -
                  | or by something stranger still. -- Steven Weinberg



More information about the NCLUG mailing list