Adding Swap Space on the

In rare situations, you may find that you are running out of swap space. If that happens, it is useful to know how to add a swap file by hand. Using swap files is not an ideal solution, because swap files are slower than swap partitions. Since it is better than running out of memory completely, though, it is better than doing nothing. To add swap space by hand, proceed as follows:

1. Use the dd command to create a file that can be used for swapping. Specify the size of the file you want to create in 1KB blocks. For example, the command dd if=/dev/zero of=/ swapfile bs=1024 count=100000 would add a 100MB empty file.

2. Mark the newly created file as a swap file using mkswap /swapfile.

3. Now as the last step in creating the swap file, use the command swapon /swapfile. This activates the swap file and will add it to your swap space immediately. Don't forget to add RAM to your system as soon as possible, because using swap space like this really is not ideal!

Continue reading here: Understanding the proc File System

Was this article helpful?

0 0


  • Roberta
    How to extend swap file in suse 12?
    2 months ago