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

I like this suggestion of mounting a tmpfs at /var/log in order to reduce disk writes.

Is there any way to do something similar for just a single file such as ~/.xsession-errors?

My incentive for asking comes from PowerTOP,

The program 'gnome-do' is writing to file '.xsession-errors' on /dev/sdb2.
This prevents the disk from going to powersave mode.

but one could also conceivably want to do this in order to speed up an IO-intensive program.

share|improve this question
up vote 5 down vote accepted

No, there is no way you can force a single file not to be written to disk. Writes to a file are passed down to the filesystem code: if the filesystem is backed by memory (e.g., tmpfs) then data is written to a (virtual) memory location; if the filesystem is backed by a block device (e.g., ext3/4) then data is written to the block device.

You can, however, symlink a specific file to a location in a tmpfs filesystem; this will work as long as: (1) the destination of the symlink exists, and (2) the link is not removed and the file re-created in the original (disk-based) filesystem.

Concerning ~/.xession-errors, there is some special treatment in /etc/X11/Xsession (lines 63--72 as of x11-common version 1:7.5+5ubuntu1): if ~/.xsession-errors is already a symlink, then a temporary file (in directory $TMPDIR or /tmp) is used instead. So, if your /tmpor $TMPDIR filesystem is mounted from RAM, you're done.

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.