How to Add Swap Space in Linux

If the swap space is not enough, you can add a new swap file to your server. Login as root user and then run the following commands to add 10GB of swap space:

You can verify if new swap space was added successfully:

If you want to remove the swap file, run the following commands:

If you want to add this swap space permanently, you need to include it in your /etc/fstab file. Edit the fstab file and add an entry that looks like this: