Creating a Swap File
This HOWTO has been contributed by Gerald J. Normandin Jr. It has been found at: http://rio.vg/zaurus/
Swap in RAM Here's step-by-step instructions for building a swapfile in ram so you can have more memory available for applications...
- Decide how much swap you want. You can always change it later painlessly. I went with 8 megs.
- Open up the terminal/console
- Create the swapfile with the dd command:
dd if=/dev/zero of=/home/root/swapfile bs=1024 count=8192
That will create an 8 meg file. Change the "count" field to whatever size you like.
- Format the swapfile with the following command:
- Make linux recognize and utilize the swapfile:
- Run the "free" command, to make sure the swapfile is properly recognized and running.
- Add the swap to the startup scripts. Add "swapon /home/root/swapfile" to the bottom of /etc/rc.d/rc.local with vi or some other text editor, then:
cd /etc/rc.d/rc5.d ln -s ../rc.local S49local
You'll now have an 8 meg swapfile in the storage area. Since the swap is just as fast as the normal ram, you shouldn't see any performance degradation when "swapping".