To create 8 GB Swap file on linux machine
stop swap first
# swapoff -a
then create 8 Gb swap file
# dd if=/dev/zero of=/var/swapdir/swapfile bs=1024 count=8388608
# mkswap /var/swapdir/swapfile
change ownership to root on swap file
# chown root:root /var/swapdir/swapfile
change permissions
# chmod 0600 /var/swapdir/swapfile
then start swap
# swapon /var/swapdir/swapfile
now need to create the swap file entry in fstab
# vi /etc/fstab
/var2/swapdir/swapfile swap swap defaults 0 0
check swap
$ free -m
clear memory cache
sync; echo 3 > /proc/sys/vm/drop_caches
Thats it!
stop swap first
# swapoff -a
then create 8 Gb swap file
# dd if=/dev/zero of=/var/swapdir/swapfile bs=1024 count=8388608
# mkswap /var/swapdir/swapfile
change ownership to root on swap file
# chown root:root /var/swapdir/swapfile
change permissions
# chmod 0600 /var/swapdir/swapfile
then start swap
# swapon /var/swapdir/swapfile
now need to create the swap file entry in fstab
# vi /etc/fstab
/var2/swapdir/swapfile swap swap defaults 0 0
check swap
$ free -m
clear memory cache
sync; echo 3 > /proc/sys/vm/drop_caches
Thats it!
No comments:
Post a Comment