How to Create Swap File in Linux
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 the processes into swap to make room for other processes in the main memory. swap can be extended using swap file and swap partition
Follow Below Steps To Add a Swap File in Linux
We can use the dd command to create swap file and The mkswap command to set up a Linux swap area .
Create Swap File
Type the following command to create 512MB swap file :
# dd if=/dev/zero of=/swapfile bs=512M count=1
Set Up a Linux Swap
Type the following command to set up a Linux swap area in a file:
# mkswap /swapfile or Use -f to force
Now activate /swapfile swap space:
# swapon /swapfile
Make an entry in /etc/fstab file to mount permanently
Add Below entry to /etc/fstab file:
# vi /etc/fstab
Append the following line:
/swapfile swap swap defaults 0 0
Run below command to update the swap space
#swapon -a
How to verify Swap is activated or Not?
Simply use the free command:
# free -m
# swapon -s
You Can Check My YouTube Video to Understand more !!!!
Follow Below Steps To Add a Swap File in Linux
We can use the dd command to create swap file and The mkswap command to set up a Linux swap area .
Create Swap File
Type the following command to create 512MB swap file :
# dd if=/dev/zero of=/swapfile bs=512M count=1
Set Up a Linux Swap
Type the following command to set up a Linux swap area in a file:
# mkswap /swapfile or Use -f to force
Now activate /swapfile swap space:
# swapon /swapfile
Make an entry in /etc/fstab file to mount permanently
Add Below entry to /etc/fstab file:
# vi /etc/fstab
Append the following line:
/swapfile swap swap defaults 0 0
Run below command to update the swap space
#swapon -a
How to verify Swap is activated or Not?
Simply use the free command:
# free -m
# swapon -s
You Can Check My YouTube Video to Understand more !!!!
How to Create Swap File in Linux
Reviewed by TecGeeks News
on
May 04, 2016
Rating:
No comments: