• HOME
  • TECH BLOG
  • MIGRATING TO AMAZON WEB SERVICES
  • IT PROJECT MANAGEMENT BLOG
  • Q&A
  • INTERACTIVE LEARNING
Pop-up Preset:








CREATE A SWAP FILE



Swap is a space on a disk that is used when the amount of physical RAM memory is full. When a Linux system runs out of RAM, inactive pages are moved from the RAM to the swap space. Swap space can take the form of either a dedicated swap partition or a swap file. In most cases when running Linux on a virtual machine a swap partition is not present so our only option is to create a swap file.



​



FREE -H



$ free -h



run free -h TO CHECK MEMORY AND SWAP utilization











​



fallocate



$ sudo fallocate -l 1G / swapfile



We Create a file which will be used for swap with a size of 1 gb.











​



chmod



$ sudo chmod 600



SET THE CORRECT PERMISSIONS ON THE SWAP FILE.












​



mkswap



$ sudo swapon /swapfile



Enable the swap and Activate the swap file.












​



swapon



$ sudo swapon /swapfile



Enable the swap. Activate the swap file.













​



free -h



$ free -h



when we check the swap utilization again we can now see there is 1 gb allocated.













CERTIFIED CLOUD EXPERTS | AWS PARTNER NETWORK
CLOUD CONSULTING FIRM | (516) 387-2085 | CONTACT US