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.

Tuesday Jul 10, 2007

Fedora 7, VMware Workstation 6, and Solaris 10 Update 3

Sheesh, I haven't blogged since February?

Well, I've been busy. Last spring I was putting in 120-150 miles per weekend preparing for doing AIDS/LifeCycle 6. All that training paid off, and I made it all the way. Every. Single. Mile. 2,300 riders raised a total of 11 million dollars, and I'm proud to have been a part of that.

This is me with the Cookie Lady. Out of the goodness of her heart, the Cookie Lady bakes (yes, by hand) one cookie for each rider, then sets up a table somewhere along our route, at a point when we've been riding about 80 or 90 miles that day. Then as the riders come through, we stop, get a cookie, and sometimes get our pictures taken with the Cookie Lady.

Oh, and I got a new laptop. I love taking my time setting up a machine the way I want it, everything just right. As a Linux user, this can be a challenge. I went to install Ubuntu on it. Seems like I always get bit by screen resolution problems with Ubuntu. Same with this version on this laptop. Sigh, maybe one day they will get that right. I actually have liked the distro when I've been able to get it to work. Next SuSE 10.2 - great, except that ssh did not work correctly and I couldn't display X windows back to my laptop from my server at the office. Since being able to do that is critical to my day to day work, no SuSE.

So I downloaded Fedora 7. I haven't used a Red Hat-based Linux variant since Red Hat 9 days. Well, Fedora 7 installed and worked just fine, once I figured out how to get all the little bits and pieces that I like to use, like Flash and Acrobat Reader. Heck, the updater even works. Well, sort of. As long as it doesn't run into dependency problems. For example, it will tell me I have 17 packages to update, but if one of them has a dependency issue, it will stymie the entire update. Brilliant.

OK, so now I've got this really interesting new project to work on. More about it in a later entry, but the first task involves creating a Solaris 10 Update 3 VMWare image. I install VMWare no problem. I cut a Solaris 10 U3 DVD. I create a new virtual machine for Solaris 10 and then boot it.

And it crawls through the installation. I mean really crawls. 3 hours to install Solaris 10. It all works, but man, is it slow.

It try the obvious stuff. Bump up memory. Still slow. Try preallocating the disk space. Still slow. Google. I find an entry that suggests creating an ISO file, putting it on your hard drive, and pointing the virtual CD-DVD drive at the ISO file instead of using the real DVD.

So I do it.

Bingo! Solaris installs in a very reasonable amount of time. Same laptop, same everything.

After installation, I remove the DVD and reboot the OS. And wait. And wait. And wait. Solaris takes about 15 minutes to come up.

So, no longer clueless, I reconfigure the virtual machine so that it is running with the virtual CD-DVD drive disconnected. Once again, I reboot.

Voila! Now Solaris boots up under VMWare Workstation 6 in a very reasonable amount of time, just a minute or two.

I've obviously hit some bug where Solaris 10 does not handle my stock ATAPI CD-DVD drive on my stock laptop very well. I think it might be this one: http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6227829. I have not tried playing around with the dma-enable settings as the bug circumvention recommends, mainly because disconnecting the virtual CD-DVD drive seems to have done the trick and is acceptable. It is unlikely that I will need the drive for the particular solution I'm building, but if I do need it, I can always re-enable it in VMWare Workstation, use it as needed, then disconnect it again.




« July 2016