Tuesday, May 29, 2007

 

How to add swap space to a running Linux kernel

I've found this to be quite interesting when working with a virus particle, even for the smallest of the picornaviruses. You just have to perform some commands, and your virtual memory gets multiplied to tackle those huge structural problems.

First of all, you need to be root user for a brief time.

cd /var/tmp <- Go to the area where the temporary swap space will be located.
dd if=/dev/zero of=myswap1 bs=1024 count=1048576 <- Create a '0'-filled archive.
mkswap -c -v1 /var/tmp/myswap1 <- Actually make the swap space.
swapon /var/tmp/myswap1 <- Activate the swap space and add it to the kernel memory mapping facility.

You can make as many swap files as you need. I don't know if their size has a limit.

This page is powered by Blogger. Isn't yours?