Project

General

Profile

Feature #7537

want nextboot (one time boot) support

Added by Toomas Soome about 4 years ago. Updated 19 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
zfs - Zettabyte File System
Start date:
2016-11-06
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

Originally created by Andriy Gapon as https://reviews.freebsd.org/D7612.

The idea is to provide an mechanism for "one time" boot config, meaning, if such config is set, the system will read and remove this config on next boot, and the followup boot will use normal (permanent) boot configuration.

The "nextboot" configuration is stored in pool label pad2 area, which is currently otherwise unused. The boot loader will read the pad2 content, and will remove the config by zeroing the pad2 area, so the next boot will not see the nextboot config and will use normal bootfs property based setup.

Since in illumos the boot environments are managed by beadm command, I don't see much need for another separate tool, so I did extent beadm activate to have two addition options, -t to set nextboot config and -T to remove it. Also beadm list and bootadm list-menu are updated to present the information.

Use case example:

root@test:/home/tsoome# beadm activate -t test
Activated successfully
root@test:/home/tsoome# beadm list
BE             Active Mountpoint Space Policy Created
multiboot-16   -      -          5,56M static 2016-10-30 23:53
multiboot-17   NR     /          106K  static 2016-11-06 13:42
test           T      -          12,6G static 2016-11-06 13:45
root@test:/home/tsoome#

and after reboot:

tsoome@test:~$ beadm list
BE             Active Mountpoint Space Policy Created
multiboot-16   -      -          5,56M static 2016-10-30 23:53
multiboot-17   R      -          2,42M static 2016-11-06 13:42
test           N      /          12,7G static 2016-11-06 13:45
tsoome@test:~$

Some time has passed since this work was started, now the current update is based on two changes:
https://reviews.freebsd.org/D25512
and
https://github.com/openzfs/zfs/commit/108a454a4604df6ea3be817f3cf076726df2c67a

We are using nvlist based data encoding in bootenv area (previous pad2), we provide tooling to update nvlist from os and from boot loader. This way we can implement persistent data storage.

Loader zfs reader is updated to handle bootenv nvlist read and write, and nvlist updates (remove pair, add pair).

From OS userland, the data translation to/from nvlist is done in libzfsbootenv.

The initial publication of this change is https://illumos.org/rb/r/249/, now also available on Gerrit.


Related issues

Related to illumos gate - Feature #13062: loader: make env_discard() publicClosedToomas Soome

Actions
#1

Updated by Electric Monk 5 months ago

  • Gerrit CR set to 777
#2

Updated by Toomas Soome 5 months ago

  • Description updated (diff)
#3

Updated by Toomas Soome 3 months ago

#4

Updated by Electric Monk 19 days ago

  • Status changed from New to Closed
  • % Done changed from 80 to 100

git commit b713c91e508f40be7797bedd4ae1146ef0652625

commit  b713c91e508f40be7797bedd4ae1146ef0652625
Author: Toomas Soome <tsoome@me.com>
Date:   2020-11-13T17:03:33.000Z

    7537 want nextboot (one time boot) support
    Reviewed by: Jason King <jason.brian.king+illumos@gmail.com>
    Reviewed by: Andy Fiddaman <andy@omniosce.org>
    Reviewed by: C Fraire <cfraire@me.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF