I run a fedora 27 server mainly for an email service, that is mainly used for temporary email communications by a software. Almost nothing permanent need to be stored on the /var, maybe except it's still good to keep the /var/log..

I know fedora already using tmpfs for /tmp which is great! I want to further conserve my HDD by putting the /var on tmpfs too!.. But also would like to keep the /var data somewhere on the disk.

So I'd like to be able mount the /var as tmpfs - just like the /tmp is already now - but be able to also backup the /var to the disk somewhere at shutdown (or maybe even better if can backup at certain time interval), and also restore the /var from disk at boot up.

Has anybody already done this? Can you please share how this can be done?

  • 2
    How would you deal with a power outage? – Kusalananda Sep 7 '18 at 7:42
  • Welcome to this site! You say "Almost nothing permanent need to be stored on the /var", are you sure? Any MySQL (or Postgre, or...) databases? The mail queue is usually kept in /var. That said, rsync is probably the best tool to sync your /var to a backup location. – Mr Shunz Sep 7 '18 at 7:50
  • 1
    Placing /var in tmpfs is a terrible idea. Far better to identify the oft-changing files that are worrying you and ensure they alone are placed in tmpfs. – steve Sep 7 '18 at 7:53
  • Hopefully UPS is good enough for power outage..? – shoestring Sep 7 '18 at 7:53
  • 1
    If you intend to keep the contents of /var on disk, might I suggest you put them in /var? In other words, the system is already doing what you want, just much more effectively than with tmpfs. – Michael Hampton Sep 7 '18 at 12:39

After digging deeper into the question, and learning more from the feedbacks, I think Michael is right.. Seems Fedora has already taken care of this indeed..


So this seems to mean the logs will only commit to disk after every 5m correct?

And if so, then the HDD situation is not so terrible as I thought afterall..? All those disk-writes showing on the graph probably to mean writing to the cache then.. Would this be correct?

For the /var/mail or /var/spool/mail I think I'll mount it on another partition and add commit=600,noatime which should be good enough.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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