Wikula » SwapFile
Sometimes your RAM and swap partition are not enough, and you might not want to touch your partition sizes. The solution is to create a swap file instead, which performs almost the same as your swap partition. For a 2Gb swap file e.g. do:
dd if=/dev/zero of=/swapfile1 bs=1024 count=2097152
to create it. Now format it and make it active:
mkswap /swapfile1 && swapon /swapfile1
If you decide to keep this active after your next re-boot, simply add to your /etc/fstab:
/swapfile1 none swap sw 0 0
b) On older hardware with a small HDD before installing aptosid, where you do do not want to keep a large swap partition, but need a swapfile while installing.
c) On a workstation where you want to do nasty stuff with huge memory needs.