Sometimes, we need to increase the swap file for better performance and procedure as below.
First, Create an 1024MB filesize:
# dd if=/dev/zero of=/swapfile bs=1024 count=1048576
1. if=/dev/zero : Read from /dev/zero file. /dev/zero is a special file in that provides as many null characters to build storage file called /swapfile.
2. of=/swapfile : Read from /dev/zero write stoage file to /swapfile.
3. bs=1024 : Read and write 1024 BYTES bytes at a time.
4. count=1048576 : Copy only 1048576 BLOCKS input blocks. [ 1024 * 1024MB = 1048576 ]
Make the file as swap filesystem:
# mkswap /swapfile
Set the permission for /swapfile:
# chown root:root /swapfile
# chmod 0600 /swapfile
Activate Swap file:
# swapon /swapfile
Activate /swapfile after Linux system reboot:
# vi /etc/fstab
add the below line.
/swapfile swap swap defaults 0 0
First, Create an 1024MB filesize:
# dd if=/dev/zero of=/swapfile bs=1024 count=1048576
1. if=/dev/zero : Read from /dev/zero file. /dev/zero is a special file in that provides as many null characters to build storage file called /swapfile.
2. of=/swapfile : Read from /dev/zero write stoage file to /swapfile.
3. bs=1024 : Read and write 1024 BYTES bytes at a time.
4. count=1048576 : Copy only 1048576 BLOCKS input blocks. [ 1024 * 1024MB = 1048576 ]
Make the file as swap filesystem:
# mkswap /swapfile
Set the permission for /swapfile:
# chown root:root /swapfile
# chmod 0600 /swapfile
Activate Swap file:
# swapon /swapfile
Activate /swapfile after Linux system reboot:
# vi /etc/fstab
add the below line.
/swapfile swap swap defaults 0 0
No comments:
Post a Comment