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?

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

Your Answer

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

Browse other questions tagged or ask your own question.