Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm developing a Java EE web application and I'm trying to speed up the testing process. To do so I was wondering if there is a way to tell the system to keep my build folder in system memory?

share|improve this question
1  
Any particular OS, or should we just pick a random one for you? –  Ignacio Vazquez-Abrams Jan 10 '12 at 2:21
    
Sorry, I didn't think which distro mattered. It's Linux Mint –  Alan B. Dee Jan 10 '12 at 2:58
    
Distro doesn't. OS does. –  Ignacio Vazquez-Abrams Jan 10 '12 at 3:03

3 Answers 3

up vote 2 down vote accepted

Yes. You can put the folder in a RAM disk.

I would write up instructions, but a lot of people have already done good jobs at that, like the guy that wrote http://blulin.wordpress.com/2008/11/28/tips-to-create-ramdisk-in-a-linux-system/

Keep your source and work in a folder on a hard disk, and when you're going to test, just rsync that directory to the ramdisk you're going to create using the page i linked to.

Do all your testing.

Save all your work back to your folder on the hard disk.

Voila!

ps. That "Save your work" step is a must. When you unmount a ramdisk, everything is gone. there is no such thing as a ram disk that provides persistent storage.

share|improve this answer

Normally the system puts everything into cache as long there is free memory available, so normally this step does not seem to be necessary.

Check if there is a /dev/shm mountpoint. On most distributions halve of your RAM is mounted there as ramdisk.

share|improve this answer

You can use tmpfs.

tmpfs is a fast, dynamically allocated, easy to use, temporary file storage facility, that will swap to disk when you run out of memory. Although a ramdisk has some advantages in other use cases, tmpfs will suit your needs best.

For one time use:

sudo mount -t tmpfs none /path/to/directory

When you want to mount the directory as tmpfs everytime you boot, append the following to /etc/fstab:

none /path/to/directory tmpfs defaults 0 0

Warning: Everything you write into your tmpfs directory will be lost on shutdown, so save or rsync everything when you are done.

share|improve this answer

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.