1

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?

9
  • 2
    How would you deal with a power outage?
    – Kusalananda
    Commented Sep 7, 2018 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. Commented Sep 7, 2018 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
    Commented Sep 7, 2018 at 7:53
  • Hopefully UPS is good enough for power outage..?
    – shoestring
    Commented Sep 7, 2018 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. Commented Sep 7, 2018 at 12:39

1 Answer 1

0

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..

journald.conf 
#SyncIntervalSec=5m 

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.

You must log in to answer this question.

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