Using a swap file

  1. Create swapfile. General store math is 1024 x GB desired is what you will want. So here is an example of creation of an 8G swapfile for usage on an 8GB RAM laptop to be able to suspend:

    sudo dd if=/dev/zero of=/swapfile bs=1M count=8192
  2. Fix permissions

    sudo chmod 600 /swapfile
  3. Have Linux format the swapfile as swapspace

    sudo mkswap /swapfile-additional
  4. Here is the /etc/fstab entry:

    /swapfile swap swap    0   0
  5. Now mount the swap area, run below given command.

    sudo mount -a
  6. Enable the swap area

    sudo swapon -a
  7. Check the number swap space mounted on your system

    sudo swapon -s
  8. To check how much is swap space available on system.Run below given command

    free -m