Categories
Knowledge Support Support exacqVision Server Categories Products

Manually Create a Swapfile in Linux

Step 1: Determine if a swapfile already exists

Open a Terminal and enter the command

free -m

If the result shows the swap has 0 total MB, 0 used MB, and 0 free MB then there is no swapfile.

Step 2: Check the Amount of Available Free Space

In Terminal, enter

df -h

Step 3: Create a New Swapfile

In this example the swapfile will be placed on the root directory and will be 10 gigabytes in size.

In Terminal, enter

sudo fallocate -l 10G /swapfile

Step 4: Enable the Swapfile

In Terminal, enter

sudo mkswap /swapfile

Then,

sudo swapon /swapfile

Verify this was created by entering,

sudo swapon -s

Step 5: Make the Swapfile Persistent

In Terminal, enter

sudo gedit /etc/fstab

Any file editor will do, here we are using gedit.

When the file opens, add a new line at the bottom and enter

/swapfile none swap sw 0 0

Save and close the file.