OS Hacking and more.

6.27.2008

Problem of the ZFS live boot

The Problem:
We want a live ZFS boot that can be installed on a usb drive and booted on any machine.


Target Selection:

Opensolaris is the only OS that really can harness ZFS in a stable manner, so it has to be a target...The problem is that the Opensolaris ZFS boot processes listed above are tied to the boot hardware. Let me explain--

The ZFS boot from 2008.05 uses the file zpool.cache to find where the boot device is, and zpool.cache stores record of where the device was plugged in as of the last boot. Reading from zpool.cache, kernel is able to find out what device contains the zfs-bootfs, as well as what pool it is a part of. This method relies on the fact that whatever was true (with regard to device locations) remains true when you start the computer next. It's great if you know your HD won't be moved, but a USB drive moved to a different port (on the same or different machine) will hold a different device number, and kernel will try to find the drive at a previous port during the boot, only to fail horribly.
I tried this and the verdict is that no boot from this method could ever be considered live...

The ZFS boot from SXCE b9X sounds a great deal better; it should, in theory, discover your ZFS pool, volume, etc. and then boot off of it regardless of its location. GRUB has actually been modified in this case to be able to read ZFS volume data from a drive, and thereby find the boot device. Unfortunately, this mechanism has some evil dependencies. While GRUB's findroot() finds the zfs volume to be booted from, it doesn't know that device's location, so it queries the volume for that information. Because kernel has not started yet, and device have not really been set up, the zfs volume simple recalls where it was last connected, and returns that to GRUB. GRUB passes this potentially invalid information on to kernel, and in the case of a live or moved disk, kernel vomits it right back out. No live boot here...

The Live CD/USB doesn't boot off ZFS, but it provides an interesting model for a boot; load a self-contained ramdisk image, start kernel, and mount the USB drive's filesystem and nonessential files shortly thereafter. This means we have a running system before any media has been mounted, and we can mount things from there.



Previous Step

Next Step

<<<<>>>>

No comments: