Background :
Sometimes, physical memory doesn’t enough to handle a dozen process on an ubuntu machine, so we need additional memory to handle it.
But, buy new memory need more cost, on linux box, there’s simple way to solve it by utilizing hard drive as swap memory.
The steps:
if on first install, we didn’t specify swap partition, we can create a file and make it as swap file:
1. Login as root (super user)
2. invoke this command :
dd if=/dev/zero of=/mnt/2GB.swap bs=1M count=1024
this command tell the system to make a file contain 1024 block, which on every block the size is 1 Megabytes
3. Create swap device
mkswap -c /mnt/2GB.swap
-c option is used for checking the integrity of file.
4. activating swap device
swapon /mnt/2GB.swap
5. Edit file /etc/fstab to make it permanent
add the following line :
/mnt/2GB.swap none swap sw 0 0
to make sure that the swap already activated, invoke the following command:
cat /proc/meminfo