Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Which files/directories can I move to RAM drive to have the system working faster?

I'm planning to upgrade my laptop's memory to 8GB soon, so I'll have some fast memory to use. How to configure the system to work optimal with this memory?

The next changes I consider next are: - upgrading hard drive to SSD - start using virtualization (I need Windows sometimes)


Maybe I can sacrifice boot time, and copy some files to RAM drive during boot?

share|improve this question
up vote 5 down vote accepted

To mount /tmp /var/log and /var/tmp in RAM. Add these lines to the end of fstab to mount /tmp (temporary files) as tmpfs (temporary file system):

tmpfs /tmp     tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/log tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0 0

Save, then: sudo mount -a

Reboot for the changes to take effect. Running df, you should see a new line with /tmp, /var/tmp and /var/logs mounted on tmpfs.

Note: all log files will be lost after a reboot, to back them up manually run this in terminal:

rsync -av /var/log/* ~/saved_logfiles

To move Firefox Cache Into RAM:

Type about:config in firefox address bar and click I'll be careful,I promise!. Right click on blank area and create a new string value called:


Set its value to /tmp

Restart Firefox.

share|improve this answer
How can I automate this rsync command to run it on logout, system shutdown or hibernation? – takeshin Feb 1 '12 at 22:24
/var/tmp should NOT be placed in tmpfs. See user95602's answer – Елин Й. Sep 28 '14 at 18:45

As per the Filesystem Hierarchy Standard for Linux, /var/tmp should NOT be placed in tmpfs:

The /var/tmp directory is made available for programs that require temporary files or directories that are preserved between system reboots. Therefore, data stored in /var/tmp is more persistent than data in /tmp. Files and directories located in /var/tmp must not be deleted when the system is booted. Although data stored in /var/tmp is typically deleted in a site-specific manner, it is recommended that deletions occur at a less frequent interval than /tmp.

share|improve this answer

There's not much from a default installation to put on a ramdisk, since it will be erased every time you boot. A ramdisk is only usable for temporary files.
So directories to run of a ramdisk I can think of are /var/run/ and /var/tmp/ (maybe /tmp). I do this on Mac OSX (RamFS:

share|improve this answer

Your Answer


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.