First you need to use the command: DD to create a swapfile, and then you need to use the Mkswap command to create a Linux swap partition in the device or file
A) log in with the root user
b) Create a 2G Swap file using the following command (1024x768 * 2048MB = 2097152 block size):
# dd If=/dev/zero of=/data11/swapfile1 bs=1024 count=2097152
c) Create a Linux swap area:
# Mkswap/data11/swapfile1
d) Activate/swapfile1 swap space immediately:
# Swapon/data11/swapfile1
e) If you want to automatically activate and enable/swapfile1 after the Linux system restarts, you will need to edit the file:/etc/fstab, as follows:
# Vi/etc/fstab
Add the following line of commands:
/data11/swapfile1 swap swap defaults 0 0
After the following steps have been completed, the next time the Linux system restarts, the swap file will be automatically enabled
g) How does I verify swap is activated or not?
Simply Use free command:
$ free-m
If you want to turn off virtual memory or want to expand, first disable
Swapoff/data11/swapfile1
Swap partition Add