Create a swapfile for your Linux server

I’ve been trying to set up a larger swapfile (4GB instead of the default 2GB), but have run into this when running the script above:

rm: cannot remove `swapfile’: Operation not permitted

To get around this, I’ve had to do this first:

  1. Reboot the server (it wouldn’t let me swapoff, presumably due to heavy swapfile use)
  2. swapoff -a -v
「いいね!」 3