I am using an USB drive to start a linux system which needs changes from time to time and also writes some logs. Flash drives tend to fail early if there are many write operations. That brought me to an OverlayFS idea:

I want to have a lower filesystem which has the system and an upper filesystem that takes the changes and logs. From time to time, for example once a day, I want to copy the changes from the upper filesystem to the lower filesystem.

OverlayFS does not support writing to the lower filesystem as long as the upper filesystem is mounted. So I would assume, I need to unmount the upper fs and remount the lower fs read-write. But I am not sure what would happen if in that moment a process tries to write something to the fs.

Which would be the best way to do this?

  • 3
    What you want is called write-back caching. You may want to look into bcache, which can handle this.
    – Vincent Yu
    Commented Aug 18, 2015 at 4:57
  • Thanks. That might be indeed a solution. I'll have a look into bcache.
    – mgabriel
    Commented Aug 20, 2015 at 18:14
  • I've posted a couple of answers to my own question (unix.stackexchange.com/q/393930) which covers this topic.
    – ejm
    Commented Sep 23, 2017 at 2:50
  • I have a similar use case. Have you found a satisfactory solution? Commented Jul 3, 2021 at 8:41


You must log in to answer this question.

Browse other questions tagged .