To make my life easier while testing ZFS on root, I wrote a simple script to automate the installation, as documented on Tabriz’s blog, which you should read before going any further…

As with anything new like this, I’m going to apply a strong disclaimer : this works for me on the machines I’ve tried it on, but YMMV — make a backup of data you care about on your system, cross your fingers before running it and think happy thoughts!

For the script to work, you need to run it as root on an x86/x64 machine with a fresh install or upgrade of Solaris Express from nv_37 upwards (not just BFUd to that level, but optionally with any BFUs after that date). Give the script arguments of disks or slices with enough space to install your root filesystem, and those disks or slices must not be mounted when you run the script.

Whew. With all those disclaimers disclaimed, you can get the script here – all comments welcome!

Updated 12th May 2006: Fixed a problem with the script not understanding comment lines in /etc/vfstab. Works fine now.

Updated 16th May 2006: Carl suggested a few things in the comments, so I’ve updated the usage message, and added an exit 0 to be polite. (Thanks Carl!)

Updated 22nd May 2006: Clarifications on Carl’s point mean I’ve now got the exit 0 in the right place :-)