For the last week, I experienced some low memory problems, both in RAM and swap space. I admit that I’m using Firefox with a lot of addons that I find useful, so I tried, at first, to uninstall some of them (those I’m not using too often). I had to close also, when not needed, some “always running” utilities, like gkrellm, amarok, kopete and korganizer.
I have 512 MB RAM in my system and a separate swap partition of the same size in my hard disk. Although the system worked most of the time (even when I used gcc compiler), it was constantly swapping in and out applications and yesterday evening my swap space reached 0 bytes of free space.
I thought that an increase of the swap partition size might solve the problem, but I didn’t want to fiddle with my disk and I called this solution “plan B”.
As “plan A” I decided to make more swap space by creating a swapfile. The commands I used are the following:
# dd if=/dev/zero of=/home/swapfile bs=1024 count=1048576
# mkswap /home/swapfile
Setting up swapspace version 1, size = 1073737 kB
no label, UUID=267d82f3-0f53-42d6-bf72-6fc4bf36b8f4
# swapon /home/swapfile
# vim /etc/fstab
where I added the following line:
/home/swapfile none swap sw 0 0
After executing these commands, my swap space increased instantly to 1 GB, without a need to reboot and without any cost (except for 1 GB of disk space of course).
So far the system is healthy again, with a lot of usable memory, and all my favorite applications are running together as before.
Visit The Light of the LAMP blog for more…