Tuesday Oct 09, 2007

ZFS and File System State Management

ZFS, available from Solaris 10 update 2 on, is one amazing piece of technology. Bloggers like Drew get what I get about ZFS, which is that once you grok its features and start combining them, you can do some weird and wonderful things.

State management of training machines is something I've been trying to do well for about 15 years now. I've been through a lot of technologies like Norton ghost, scripting, jumpstarting, and OS virtualized images and while they all work, they also have limitations that often make me have to settle for less than what I really want to do.

So I was playing around with a VMware Solaris 10 Update 2 a couple of months ago that had /z, a big ol' ZFS file system, about 5 GB on it, and a whole root zone completely encapsulated within the ZFS file system. Here's what I was able to do with it:

  1. First, I took a ZFS snapshot called z@machinestartstate.
  2. I booted and logged into the whole root zone.
  3. I set the zone up to have the start state for one of the classes for which I am responsible. Let's call it class 1.
  4. I took another ZFS snapshot called z@class1startstate.
  5. I saved the deltas between the two snapshots: zfs send -i z@machinestartstate z@class1startstate > machinestartstate.class1startstate.
  6. I did Lab 1.
  7. I took another ZFS snapshot called z@class1lab1endstate.
  8. I saved the deltas between the two snapshots: zfs send -i z@class1startstate z@class1lab1endstate > class1startstate.z@class1lab1endstate.
  9. I did Lab 2.
  10. I took another ZFS snapshot called z@class1lab2endstate.
  11. I saved the deltas between the two snapshots: zfs send -i z@class1lab1endstate z@class1lab2endstate > class1lab1endstate.class1lab2endstate.
  12. I followed the same steps for Labs 3 through 10, and then did the same things for 5 other classes I am responsible for.
Now look at the possibilities I have. As long as I can get back to my original virtual machine image, I can play the delta files back to any state I want:
  • zfs rollback -r z@machinestartstate always takes me back to the original virtual machine state.
  • zfs recv < machinestartstate.class1startstate
  • restores the start state for class 1.
  • zfs recv < class1startstate.class1lab1endstate
  • restores the end state for Lab 1 of class 1.
and so forth. In subsequent blog entries, I'll be writing about how to create a Solaris 10 VMware virtual machine for this setup, and provide workarounds for some issues I found while getting this working.
About

dgolds

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today