GNU/Linux Desktop Survival Guide by Graham Williams |
|||||
If running out of swap you can add 257MB more. First have a look at what you have available:
# free total used free shared buffers cached Mem: 256216 252208 4008 118100 56996 46944 -/+ buffers/cache: 148268 107948 Swap: 224900 51268 173632 |
Next create a file without holes and a multiple of 4K in size:
# dd if=/dev/zero of=/extra-swap bs=1024 count=262144 262144+0 records in 262144+0 records out |
Now mark it as a swap file by writing a signature to its beginning which contains some administrative information and is used by the kernel:
# mkswap /extra-swap Setting up swapspace version 1, size = 268431360 bytes |
Now tell the kernel about the new swap file:
# swapon /extra-swap |
Now check it is there!
# free total used free shared buffers cached Mem: 256216 252448 3768 118100 56996 46944 -/+ buffers/cache: 148508 107708 Swap: 487036 51268 435768 |
To remove the swap file from usage:
# swapoff /extra-swap |
/extra-swap none swap sw 0 0 |
Then on boot when swapon -a is run the new swap will be added to swap space.