You have two options: add a swap partition or add a swap file. It is recommended that you add a swap partition, but sometimes that is not easy if you do not have any free space available.
At a shell prompt as root, type the following command with count being equal to the desired block size:
# dd if=/dev/zero of=/swapfile bs=1024 count=1024000
in the count type the amount of space you wont for your swap file. For example, 1024000=1GB
Setup the swap file with the command:
# mkswap /swapfile
To enable the swap file immediately but not automatically at boot
# swapon /swapfile
Or use # swapoff /swapfile to disable the mount.To enable it at boot time, edit /etc/fstab to include:
# vi /etc/fstab
/swapfile swap swap defaults 0 0
The next time the system boots, it will enable the new swap file.
After adding the new swap file and enabling it, make sure it is enabled by viewing the output of the command
# cat /proc/swaps
or# free
No comments:
Post a Comment