Note: $THIS_IS_A_VARIBLE
Create
1. Check Memory Space – to check how much you need to add.
free -m
2. Create a Swap File
dd if=/dev/zero of=SWAPFILE_DIRECTORY bs=1M count=SPACE(MB)
The unit of “count” changes as “bs”.
3. Format the Swap File
mkswap $SWAPFILE_DIRECTORY chmod -R 600 $SWAPFILE_DIRECTORY
4. Turn on/off Swap
swapon $SWAPFILE_DIRECTORY
5. Enable it when boot
vim /etc/fstab # Add this in the file $SWAPFILE_DIRECTORY swap swap defaults 0 0
Turn off/Disable
swapoff $SWAPFILE_DIRECTORY swapoff -a # Turn off all
vim /etc/fstab # Delete/Comment out this in the file $SWAPFILE_DIRECTORY swap swap defaults 0 0