Archive

Posts Tagged ‘memory’

Temporary Linux swap in user space

August 29th, 2011 No comments

Once in a while, you might run into a situation where you need some extra RAM (or swap) for a short time. (I ran into this situation today while stitching some really enormous images in Hugin). Adding a new swap partition isn’t practical if you only need the extra swap space for a short time.

If you have enough space in your home directory (or elsewhere on your filesystem) then you can use this as a temporary swap file without making a partition.

First we allocate the file that will be used as swap. This is where we set the size. In this example, I’ve chosen 10GB.

truncate -s 10G ~/tempswap

Now we tell this file to be a swap file:

mkswap ~/tempswap

And finally we can tell our system to use the new swap file (on top of any existing swap files):

sudo swapon ~/tempswap

To check on your memory and swap availability and usage, try:

free -m

This swap file won’t be used as swap on next boot unless you add it to your /etc/fstab, but you’ll still have to delete the file to get the space back. To clear up after yourself manually, do this:

sudo swapoff ~/tempswap
rm ~/tempswap

Categories: Linux Tags: , , ,

An unlikely correlation

February 5th, 2010 1 comment

I just spotted that my Nagios/RRD graphs of my home server are showing a strange correlation.

From these graphs, it seems that the higher the outdoor temperature, the more free memory the system has available. I’m sure this is just a coincidence, though…

Outdoor temperature

Free memory

Categories: Gadgets, Linux Tags: , , , ,