oreilly.comSafari Books Online.Conferences.

Apache FAQ
Linux FAQ

Log in to particpate

   Linux FAQ > 5. File Systems, Disks, and Drives
Question:  5.11. How To Add Temporary Swap Space.

In addition to a swap partition, Linux can also use a swap file. Some programs, like g++, can use huge amounts of virtual memory, requiring the temporary creation of extra space. To install an extra 64 MB of swap space, for example, use the following shell commands:

   # dd if=/dev/zero of=/swap bs=1024 count=65535
   # mkswap /swap
   # swapon /swap

The count= argument to dd determines how big the swap file will be. In this example the swap file's name is /swap, but the name and location are, generally, arbitrary, depending only on the file system's available space and your having write permissions in the directory.

When you don't need the swap space any more, remove it with the following statements:

   # swapoff /swap
   # rm /swap

Take a look also at the Installation HOWTO and Installation & Getting Started for detailed instructions.

If that still doesn't provide enough swap space, refer to ("How To Have More Than 128Mb of Swap.")

This FAQ is from Linux Frequently Asked Questions with Answers, maintained by Robert Kiesling

Sponsored by: