My current laptop hard drive (Seagate ST940818SM) is slow (max 42MB/s R/W speed) and out of space. Mounting /tmp and /var/tmp as tmpfs does a lot of performance improvement. So is it safe to mount /var/log as tmpfs?

I don't care about logs on my laptop. Will it improve battery backup time somewhat? As log files are on RAM, this allows complete hard drive spin down during no activity period.

  • Do you write much to /var/log anyway? Also, some programs write to subdirectories under /var/log and may be upset when these suddenly disappear after a reboot. Jun 20, 2015 at 18:09
  • It might not be a good idea to mount /var/tmp as tmps: reference
    – jarno
    Feb 4, 2016 at 9:46

1 Answer 1


Technically, you can mount /var/log as tmpfs. You'd need to be sure that /var/log is mounted before syslogd starts, but that's the case by default on most distributions since they support /var on a separate partition.

You'll obviously lose all logs, which I guarantee will be a problem one day. Logs are there for a purpose — there're rarely needed, but they're there when they're needed. For example, if your system crashes, what was it doing before the crash? Since when has this package been incstalled? When did I print this document? etc.

You won't gain much disk space: logs don't take much space relative to a hard disk. Check how much space they use on your system; I'd expect something like 0.1% of the disk size.

You won't gain any performance. Logs amount to a negligible part of disk bandwidth on a normal desktop-type configuration.

The only gain would be to allow the disk to stay down, rather than spin up all the time to write new log entries. Spinning the disk down doesn't save much electricity if any: the hard disk is only a small part of a laptop power consumption, and spinning up requires a power surge. Furthermore spin cycles wear down the disk, so don't spin down too often. The main reason to spin down is the noise.

Rather than putting logs on tmpfs, arrange for your disk not to spin up when a file is written. Install Laptop Mode, which causes writes to disk to be suspended while the disk is spun down — only a full write buffer, an explicit sync or a disk read will spin the disk back up.

Depending on your configuration, you may need to instruct the syslog daemon not to call sync after each write. With the traditional syslog daemon, make sure that all file names in /etc/syslog.conf have - before them, e.g.

auth,authpriv.*         -/var/log/auth.log

With rsyslog, also make sure that log file names have - before them; the log files are configured in /etc/rsyslog.conf and /etc/rsyslog.d/*.

  • Probably, if something go wrong, it is easy to just comment out the line with tmpfs in /etc/fstab. In fact, I can think of the case when one needs to move logs to tmpfs — I just have one ☺ It is when the system is installed to a cheap usb stick, they tends to have very slow IO.
    – Hi-Angel
    Jan 31, 2016 at 14:23
  • @Hi-Angel Logs can be useful when investigating past events. Commenting out the fstab entry will only allow to investigate future events. That might make a big difference.
    – jlliagre
    Sep 9, 2016 at 11:40
  • 7
    This can be useful when reducing the number of writes on a drive to increase the lifespan (especially for embedded systems with SD-cards).
    – Yeti
    Jan 30, 2017 at 13:23
  • 2
    "You won't gain much disk space: logs don't take much space relative to a hard disk." My logs grow at a rate of a few GB per hour. Jun 11, 2019 at 4:26
  • But in this case ram disk wont save you !
    – basos
    Nov 3, 2022 at 16:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .