[gsoc15] dynamically discover bes

Prasad Joshi prasadjoshi.linux at gmail.com
Tue Jun 9 01:06:20 UTC 2015


Last week I mostly worked on understanding beadm and gptzfsboot code

beadm create prepares new BE by creating a snapshot and clone of that
snapshot. beadm activate command sets bootfs property of the POOL.
bootfs property contains object number of active dataset object.
During bootup gptzfsboot probes all the disks, creating SPA for any
valid pool. gptzfsboot assumes the first pool it finds as a primary
pool, it then reads meta object set, then tries to find object nunber
of active dataset object either through
a. bootfs - it would be set if BE was already created
b. mos->properties_zap->root_dataset->dd_head_dataset_obj (through
root_datasets bonus buffer)
Once the object number is obtaind gptzfsboot mounts the dataset.

After mounting, few files are looked up like /boot/config or
/boot.config for presense of boot command (did not went into details
of this). Then (if keyboard is not hit), gptzfsboot execs
/boot/zfsloader. If gptzfsboot is interrupted by keyboard, then it
displays default BE or POOL it is trying to boot from (using
zfs_rlookup() to map active dataset object to string BE name). Though
I haven't checked this but through serial console user would be
allowed to enter other pool or BE to boot from.

I could not go into details of how gptzfsboot reads /boot/zfsloader from disk.

Pending Tasks
=============
1. Understand upon keyboard interruption, how user entered zfs paths
(format [zfs:pool/filesystem:][/path/to/loader]) are converted in
object numbers?
2. Learn ZFS on disk format in more details so as to identify active
dataset object numbers of all BEs. Once the object numbers are
available, I can use zfs_rlookup() function to map object number to
printable pool name.
3. Prepare library for console based menu.

Plan for next week
==================
Pending task 2 above


More information about the soc-status mailing list