*edit (thanks to nbensa / Earthwings)
Warning: swap files are a bit slower then swap partitions. If you have a lot of memory, this should not make a difference because the swap file will hardly ever get used. If you have a small amount of RAM, and are aiming for maximum performance, stick with the swap partition.
To check the amount of RAM and swap currently used and available, use the command
Code: Select all
free -m*edit (tanks to MooktaKiNG)
If you want dynamic swap files (as in Windows), use swapd (http://cvs.linux.hr/swapd/). Unfortunatly, it's not in the portage tree.
To covert your swap PARTITION to a (static) swap FILE do the following:
Make an empty file using the following command:
Code: Select all
dd if=/dev/zero of=/tmp/swap bs=1024 count=65536After this, make the file into a swap file by using:
Code: Select all
mkswap /tmp/swapFor security, chmod your swap file:
Code: Select all
chmod 600 /tmp/swapThen activate the swap by using:
Code: Select all
swapon /tmp/swapCode: Select all
*edit (thanks Biker)
swapoff /dev/hda2
mkefs /dev/hda2Look at /proc/swaps to see if it actually changed.
You should put the "swapon" command to run at boot time. It added this line to local.start:
Code: Select all
/sbin/swapon /tmp/swapDon't forget to deactivate it by adding
Code: Select all
/sbin/swapoff /tmp/swap





