How To Increase Swap Space In Linux?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1. Check current swap space on Linux First, check your system‘s current swap space usage with the command:
$ free –m
2. Create a Swap File To increase swap size, create a new file and specify the size as 1024 MB for example:
$ sudo fallocate –l 1G /swapfile
3. Change permissions of the swap file It‘s important to secure the swap file by setting permissions:
$ sudo chmod 600 /swapfile
4. Mark the file as swap space Now you should mark the newly created file as swap space.
$ sudo mkswap /swapfile
5. Enable the swap file Finally, enable the swap file with the following command:
$ sudo swapon /swapfile