ericvlog / note

6 stars 1 forks source link

How do I increase swap memory in debian? - Server Fault #17

Open ericvlog opened 2 years ago

ericvlog commented 2 years ago

To add a swap file:

  1. Create the file. This command creates a 1 gigabyte file: dd if=/dev/zero of=/swap bs=1M count=1000

  2. Format the swap file: mkswap /swap

  3. chmod 0600 /swap

  4. swapon /swap

  5. Add the new swap file to /etc/fstab

    • nano /etc/fstab
    • Copy and insert /swap swap swap defaults 0 0
    • save & exits
  6. Run swapoff -a && swapon -a to activate the new swap.

You can run free -m to find the swap space used in megabytes before and after the allocation of swap space.

https://serverfault.com/questions/218122/how-do-i-increase-swap-memory-in-debian