Adding swap space

If your server is running out of RAM and swap you can add some swap space on the fly. This gives you some time to take the system down later and add more RAM.

  1. make sure, you have 1GB left on one of your partitions (df -h)
  2. generate a new 1GB file (dd if=/dev/zero of=swapfile.0 bs=1GB count=1)
  3. change permission of the new file (chmod 600 swapfile.0)
  4. setup the swap (mkswap swapfile.0)
  5. activate the swap (swapon swapfile.0)
  6. check your memory (free)
  7. optionally add your swapfile to /etc/fstab (echo “/var/swapfile.0 swap swap defaults 0 0” » /etc/fstab)
linux/swap.txt · Last modified: 2017-12 by tb
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready