Stackable Filesystem
I’ve been thinking about how to automate the process of making a new release of a project I’m working on. Ideally when I decide to make a release I’d like to test the build and install on all the platforms I’m supporting. The best way I can think of to do that is to have a bunch of virtual Linux (VMWare, Xen or whatever) boxes which I can boot up, build and install the project on, log the results and then shut down.
I’d like any changes written to the filesystem of the virtual box to be transient - so the next time I use it to test the build it starts up in the same known state. The obvious way to do that would be to have a block device driver that starts out just like the loopback device (i.e. reading from a file that represents a block device) but have it capture any writes and store any written data in a separate data structure - a delta.
That would mean that at any time you could roll the filesystem back to its initial state by discarding the delta. Alternately you could tell it to merge the delta back into the main filesystem and thereby commit any changes you’d made.
Thinking about it a bit more it seems that this would have all sorts applications. Rolling back installations that have spewed files all over your disk; safely finding out what a virus does; the ability to roll the filesystem back if you screw something up yourself (hands up who’s never done that…).
If it was fast enough you could run your main filesystem in this mode and have a second partition or device to hold the deltas. Every now and then you’d commit the delta to the main filesystem and start again.
If the delta was organised as a log file you could choose how much of it to commit - or roll it back to an arbitrary time - “OK, let’s go back to 9:36 before I screwed everything up”. Having all the writes available in chronological order would also make it possible to safely commit the contents of the delta without unmounting the filesystem.
Now I’m assuming this is so useful that it must already exist but I can’t make Google tell me about it. SEH isn’t quite what I have in mind; I guess this paper describes something like it. If it doesn’t exist I think it should…
