Dynamically Discover BEs
FreeBSD system allows the user to create multiple Boot Environments (BE) which is bootable instance of complete operating system (OS) along with packages installed on the OS. An administrator can create and maintain multiple BEs and make one of them active. The downside however is that, at a time a only single BE can be made active. The active BE is used to boot from during next bootup.
These BEs can be managed using beadm command. beadm create command creates a new BE. Once a BE is created is, by default, it is not active. beadm activate command is used to make a BE active during next reboot. beadm activate command works by modifying GRUB configuration, it adds BE to GRUB and makes it default (utilized during the next reboot). A BE is usually given a descriptive name, to make it easy to remember. However, as the number of BEs grow, it becomes cumbersome for administrator to maintain the GRUB configuration file.
Objective of this project is to dynamically discover all BEs during bootup. The discovered BEs would be presented on console for selection. The default BE would be marked / highlighted for easy detection (to bring to users notice). This would make the life easy for user / administrator as he/ she does not have to set / reset the Boot Environments (BE).
Approach to solving the problem
Aim of this project is to modify gptzfsboot code to find all BEs of default boot dataset. In my opinion, there are two ways by which a Boot Environments (BE) can be identified.
- Identify BE using its location
Usually BE datasets are below a common directory named ROOT. For example: tank/ROOT/be1 or tank/ROOT/be2. This property can be utilized to identify BEs. However, new version of BEs need not have common ROOT directory.
- Add new property to BE
At the moment, a dataset is identified as bootable if bootfs property is set. We may use the same technique, a new property may be added for example bootbe. Each BE must have bootbe property set.