Skip to contentSkip to conversation

autoversioning?

DISCUSSION Ulli Horlacher 2 participants 2 messages Dec 9, 2016 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Is file autoversioning possible with btrfs?

I have a VMS background, where the standard filesystem automatically creates a new version for every file that is written.

The number of versions can be controlled globally, on directory or on file base.

With btrfs I can create manually a file version (clone) with "cp -a --reflink"
but I want this to be done automatically.

I could set up an incron-job (inotify), but perhaps there is a better, easier solution?

Signature · 6 lines
Ullrich Horlacher              Server und Virtualisierung
Rechenzentrum TIK         
Universitaet Stuttgart         E-Mail: [email protected]
Allmandring 30a                Tel:    ++49-711-68565868
70569 Stuttgart (Germany)      WWW:    http://www.tik.uni-stuttgart.de/
REF:<[email protected]>
#1 lore raw
Quoted 8 lines · Ulli Horlacher

Is file autoversioning possible with btrfs?

I have a VMS background, where the standard filesystem automatically creates a new version for every file that is written.

The number of versions can be controlled globally, on directory or on file base.

Quoted 7 lines

With btrfs I can create manually a file version (clone) with "cp -a --reflink"
but I want this to be done automatically.

I could set up an incron-job (inotify), but perhaps there is a better, easier solution?

The first thing that comes to mind is a FUSE module I saw a while back that does this. AFAIK, it doesn't do any reflinking, but it handles the COW needed for the versioning itself, so it works on any filesystem, not just BTRFS (and you could easily run batch deduplication from time to time on the backing storage so that you have things nicely reflinked). I sadly don't remember what the FUSE module was called though (I remember it because I thought the idea was neat, not because I need something like that), but I do distinctly remember that it exists.

Alternatively, something using fanotify would probably work better than both options, but it would have to be pretty smart to be reliable.