How To Create A Swap Partiation

[Total: 4    Average: 5/5]

Most Linux installations recommend that you include a SWAP partition. This may seem odd to Windows users, who are used to having their entire operating system on a single partition.

So what does a SWAP partition do, do you even need one, and how big should it be? These are all important questions that, with the right answers, can seriously improve your system’s performance.

Swap is space on a disk that is reserved to be used as virtual memory. When a Linux server runs out of memory, the kernel can move inactive processes into swap to make room for active processes in the working memory.

If you don’t know “How To Create A Swap Partiation?” then The steps below discuss the creation of a swap file on Linux and modifying the system swappiness value.

touch /var/swapFile

Use the following command to create 4GB of swap file:

dd if=/dev/zero of=/var/swapFile bs=1M count=4096

Type the following command to set up a Linux swap area in a file:

mkswap /var/swapFile

Activate /swapfile file swap space now:

swapon /var/swapFile

Add entry on /etc/fstab file to activate after Linux system reboot.
nano /etc/fstab

/var/swapFile   swap    swap    defaults        0 0

save and close the file.

Now check your swap space now:

free -m