1

For performance reasons I would like to stack tmpfs on top of the working directory of some programs. However, the program needs to access data previously saved in the "real" working directory, sometimes lots of data. So, instead of copying the whole folder to tmpfs, I thought of using OverlayFs in a similar fashion to DeepFreeze.

However, I would like to make the data persistent when unmounting the union (for example on poweroff), overwriting previous files with the same path, and leaving the other untouched.

Is there a way to automatically do this, without the user having to remember to "sync" the folders? I cannot find a feature of OverlayFs for this, and the alternative I could think of, namely a umount hook, seems not practical to implement.

matpen
  • 215

1 Answers1

1

You may want to take a look at   anything-sync-daemon.
It's designed to mount user-specified directories via tmpfs / overlayfs and then sync them back to persistent storage periodically, so it's pretty much exactly what you're trying to do. This page has a great overview of what it is and how it works; I know there are similar pages, as well as prebuilt packages available for many distributions.

Another option, not as applicable to your need but which I'll mention for others who may have a similar use case, is   profile-sync-daemon.
It's specifically tailored to keeping browser profile directories on tmpfs / overlayfs and works pretty much the same as anything-sync-daemon, but for a more specific use case.

Rubio
  • 579
  • 2
  • 9