mail me! sindicaci;ón

Use a swap file instead!

I’ve only recently stumbled across this, but you can now (and probably have been able to since god knows what kernel :P ) use a swap file instead of having to create a swap partition. There’s no performance impact, and it’s easy to setup/configure.

Enter the following at the CLI:

#> dd if=/dev/zero of=/opt/512MB.swap bs=1M count=512
#> mkswap /opt/512MB.swap
#> swapon /opt/512MB.swap

Obviously you can put the file wherever you want. The real benefit of utilising a swap file rather than a swap partition may already be obvious: if you want to increase your swap size, simply swapoff, create a new, bigger file – and swapon again.

Leave a Comment