Monday, April 21, 2008

extra swap files

It's easy to add extra swap space. Create some 2G blob files (assuming 32 bit):
 dd if=/dev/zero of=/var/xswap/xswap1 bs=1M count=2048
Make them swap files:
 mkswap /var/xswap/xswap1
Tell the OS to swap to them:
 swapon /var/xswap/xswap1
If "swapon -s" shows that it's working, then update /etc/fstab:
/var/xswap/xswap1  swap  swap  defaults  0 0
You can do this for as many swap files as you have disk for. As of the 2.6 kernel swap files are just as fast a swap partitions. So, the flexibility of a swap file is a better choice even with LVM.

No comments: