OS Hacking and more.


Setting up ZFS and opensolaris on USB

As we prepare the microroot to pass control to ZFS boot, we should probably prepare a functional ZFS boot volume and full opensolaris install. What we will do is quite simple--we'll use a standard ZFS boot setup as provided by 2008.05, and simply slip the microroot inside of it in such a way that GRUB can load the microroot and kernel. Recall that we'll be following the LiveCD boot model up until /sbin/init is first called, so this system must live alongside the ZFS setup.

Booting off the 2008.05 liveCD, run the installer application straight off the desktop. It will prompt you to select a volume to format and install to. Obviously this is the USB drive, and the whole drive should be used--partitioning and ZFS don't make good friends. Once this is done, it is essential that the USB drive is left in place, as a change in the device location would destroy the install as is.

MAKE SURE you have followed the steps in the previous 3 posts before doing this one.

We need to boot Solaris once from the drive to initialize the various services, but that first boot is all that should be done to the fresh installation.

Next, we need to install x86.microroot. Booting off the LiveCD once more,

we import the zfs pool:
rpool is the default boot pool name and shouldn't vary between installs.
and mount the opensolaris install volume: this is legacy mounted and should have the same name

$ zpool import -f rpool
$ mount -F zfs rpool/ROOT/opensolaris /mnt2

Once that is done, copy the modified x86.microroot(previous steps) to /mnt2/boot/x86.microroot, where the ZFS volume is mounted.

$ cp /[Path to microroot/x86.microroot /mnt2/boot/

Finally, GRUB's menu.lst needs to be modified to boot off the microroot; add an entry reading exactly as follows:

title OpenSolaris 2008.05 Live USB
bootfs rpool/ROOT/opensolaris
kernel$ /platform/i86pc/kernel/$ISADIR/unix
module /boot/x86.microroot

Make sure to export and umount the ZFS volume before shutting down..

Previous Step


Bob Dole said...

This doesn't seem to work for me. By far it's the simplest instructions I've found for a Solaris LiveUSB, but perhaps it's too easy to be true :-(

It seems that the OpenSolaris 2008.05 LiveCD doesn't setup the USB key as bootable... All I did was boot the OpenSolaris 2008.05 LiveCD and select USB as the install target. Once the install is complete my system won't boot from the USBkey. Is there some GRUB massaging that you forgot to document?

If this actually works it would be freaking awesome!

Anand Gupta said...

So I've been working on this constantly, I've updated it quite a bit. I've got it working decently now (with Gnome and little lag). Make sure you do the steps from the previous posts first though.