USING A SWAPFILE
-
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
-
Fix permissions
sudo chmod 600 /swapfile
-
Have Linux format the swapfile as swapspace
sudo mkswap /swapfile-additional
-
Here is the /etc/fstab entry:
/swapfile swap swap 0 0
-
Now mount the swap area, run below given command.
sudo mount -a
-
Enable the swap area
sudo swapon -a
-
Check the number swap space mounted on your system
sudo swapon -s
-
To check how much is swap space available on system.Run below given command
free -m