Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've been wanting to make us of a ramdisk on my Ubuntu system for a while, and have done a bit of reading online. Most of the advice centres around using /dev/shm to move files into RAM.

I wanted to try this out so I copied six 1GB files to /dev/shm, but according to gnome-system-monitor my RAM usage did not budge above 1.4GB. Is this how /dev/shm operates, or is there something else I need to do/use to ensure that files are stored in RAM and not on the HDD.

The reason I'm after the ramdisk is to speed up the analyses I run on this machine. Currently it uses at most about 1.6GB of the 24GB installed in the machine, and all that extra RAM doing nothing seems a bit of a shame.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Don't use /dev/shm, that's for a special purpose.

Instead, do something like this if you want to experiment:

sudo mkdir /ram
sudo mount -t tmpfs none /ram

Files stored in tmpfs are stored in either ram or (if there's too much memory pressure) in swap.

I don't know why you don't see an increase. Please post the actual commands you used, plus the output of the free -m shell command before and after.

You might like to read this post about understanding free memory in Linux too.

The memory will be used to cache the files from disk, so it is actually in a sense helping, assuming your load has a multi-GB working set of files. However, even heavily cached files do do some hard IO, and a ramdisk can be faster.

share|improve this answer
    
That implementation works great. Oddly, gnome-system-monitor does not show any increase in system RAM in the history panel, but free -m does. –  stjep Apr 21 '11 at 2:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.