Linux 101 : Using a regular file as a Swap space

Using regular file as swap space:

In case we run out of Swap space and we want a to quickly increase the space allocated for our swap, we could use a regular file for that purpose:

The above command fills out the file "/my_swap" with zeros. 
The size of the file is the "bs(block size) * count".
Then we will need to create the Swap space using the below command:

Then we need to activate our Swap space so it can be used:

Deleting the Swap space:

When we are done using the swap file, we could deactivate it using the below command:

Then we can liberate the space so it would be available to be used by the system:


Leave as a comment: