There are some scenarios where our Linux box is running out of swap space so in that case we can extend the swap space using swap partition but due to unavailability of free partitions on the disk, we are unable to extend it.
So in such cases we can extend or increase swap space using a swap file
### Below are the Steps to extend Swap Space using Swap File in Linux ###
Lets first check the size of existing swap space / partition using the command like ‘**free -m‘** and ‘**swapon -s**‘
**Note**: To disable the swap file for any troubleshooting point of view, use swapoff command as shown below and to re-enable swap file then use swapon command as shown in step5.
[root@linuxtechi ~]# swapoff /swap_file
[root@linuxtechi ~]#
Please share your valuable inputs and comments of this article.