How do I create a ramdisk that writes changes back to persistent storage, e.g. with aufs?

1

1

Similar to this question, but more specific:

I want a ramdisk / tmpfs that sits on top of a physical directory, exposing data of that directory.

The ramdisk should persistently cache all data on first read.

Writes should go to both the ramdisk and the directory itself (using the directory's write strategy for writes going to it, i.e. write-back/write-through depending on mount options), so it's a bit like an SSD / HDD combo (a.k.a. Fusion Drive for Macs), but for RAM on top of SSD / HDD.

How could I achieve this, e.g. with aufs, or any other system working with Linux ?

Alternatively, one way to force the directory's contents to be permanently cached in RAM (up to some limit maybe).

Archimedix

Posted 2015-01-09T13:44:22.220

Reputation: 231

Answers

0

Looks like bcache and the currently experimental bcachefs can be used to do just that.

The RAM disk acts as a cache device and persistent storage as the backing device.

Archimedix

Posted 2015-01-09T13:44:22.220

Reputation: 231

Thanks for closing the loop on your question. Can you expand your answer a little to explain how to do it? – fixer1234 – 2015-08-25T05:08:18.493