Event-driven ZFS

It’s about time I created a Sun and/or Work category for filing entries. This is only a quick entry for now as it’s not something I’ve got beyond the very basics with.

I’ve been trying my best to keep up with the good stuff that Chris Gerhard has been doing with his new home server. He’s got some cool ZFS stuff going with cron jobs taking some seriously frequent snapshots (every five minutes!).

A while back Jarod Nash (who has no blog entries) was talking to us about all of the stages involved in writing “Hello, world!” in vi to actually running it (i.e. terminals, editors, compiling, linking, executing, etc.). As part of this we got talking about Apple’s new Time Machine, which allows the end user to easily recover previously-deleted data. Jarod mentioned how the technology behind this was technically not great (when compared to Solaris’ ZFS) but the UI was. Interestingly it’s also an event-driven model and likely has some userland daemon running to handle events and create copies of deleted items.

Now there’s no way that I could even hope to write a great GUI for ZFS, but I did wonder to myself how I might go about making it work in an event-driven way. Fortunately Chris did a presentation on ZFS to us and I got the chance to bring this up—the answer, he believes, is to use DTrace.

I brought a blank DVD-R into work today and pulled down Nevada build 48, which I’ll install under vmware shortly. My aim is to create a simple slice to test ZFS with. It doesn’t need to be more than a pool with a single volume. With this I’m hoping to write some very very (I can’t stress that enough) DTrace scripts to prove that what Chris and Jarod have suggested will work.

The idea is basically to use DTrace to trap the open(2) syscall, check the flags (i.e. open for reading) and have ZFS create a snapshot at that instance. This all seemed great to me, but Tim Uglow and Matt Finch at this point decided to rock my boat by complicated things with mmapped IO, vnode pages and all sorts of other things I don’t understand and can’t hope to without doing some serious reading and researching. So the point really is that there’s no way in hell this would be useful for anything other than a test…

More updates to come when I’ve actually done something (expect failure ;).

Edit: I just realised I didn’t really explain the whole point of this. It’s really very simple: to do away with cron jobs that create unnecessary snapshots, and have the system create them as and when required (e.g. when a file is created, deleted, modified).

Tags:

Leave a Reply