Commit Graph

9 Commits

Author SHA1 Message Date
Toomas Soome
e307eb94ae loader: zfs should support bootonce an nextboot
bootonce feature is temporary, one time boot, activated by
"bectl activate -t BE", "bectl activate -T BE" will reset the bootonce flag.

By default, the bootonce setting is reset on attempt to boot and the next
boot will use previously active BE.

By setting zfs_bootonce_activate="YES" in rc.conf, the bootonce BE will
be set permanently active.

bootonce dataset name is recorded in boot pool labels, bootenv area.

in case of nextboot, the nextboot_enable boolean variable is recorded in
freebsd:nvstore nvlist, also stored in boot pool label bootenv area.
On boot, the loader will process /boot/nextboot.conf if nextboot_enable
is "YES", and will set nextboot_enable to "NO", preventing /boot/nextboot.conf
processing on next boot.

bootonce and nextboot features are usable in both UEFI and BIOS boot.

To use bootonce/nextboot features, the boot loader needs to be updated on disk;
if loader.efi is stored on ESP, then ESP needs to be updated and
for BIOS boot, stage2 (zfsboot or gptzfsboot) needs to be updated
(gpart or other tools).

At this time, only lua loader is updated.

Sponsored by:	Netflix, Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D25512
2020-09-21 09:01:10 +00:00
Robert Wing
deaff65313 bectl(8): Fix output of bectl list for the 'Mountpoint' column.
Currently, the output of `bectl list` doesn't align the 'Mountpoint' column
correctly when the 'mounted' property of a boot environment dataset is longer
than the default column width.

Set the 'Mountpoint' column width to the boot environment dataset with the
longest 'mounted' property or to the default width, whichever is greater.

PR:             241064
Reported by:	vermaden@interia.pl
Reviewed by:    kevans (mentor)
Approved by:    kevans (mentor)
MFC after:      1 week
Differential Revision:	https://reviews.freebsd.org/D26048
2020-08-19 00:09:39 +00:00
Kyle Evans
a58f19e687 bectl(8): initialize reverse earlier
This turns into a warning in GCC 4.2 that 'reverse' may be used
uninitialized in this function. While I don't immediately see where it's
deciding this from (there's only two paths that make column != NULL, and
they both set reverse), initializing reverse earlier is good for clarity.

MFC after:	3 days
2019-09-09 18:17:30 +00:00
Kyle Evans
f0298be018 bectl(8): implement sorting for 'bectl list' output
Allow 'bectl list' to sort output by a given property name. The property
name is passed in using a command-line flag, '-c' for ascending order and
'-C' for descending order. The properties allowed to sort by are:

- name (the default output, even if '-c' or '-C' are not used)
- creation
- origin
- used
- usedds
- usedsnap
- usedrefreserv

The default output for 'bectl list' is now ascending alphabetical order of
BE name.

To sort by creation time from earliest to latest, the command would be
'bectl list -c creation'

Submitted by:	Rob Fairbanks <rob.fx907 gmail com>
Reviewed by:	ler
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D20818
2019-09-04 13:59:06 +00:00
Kyle Evans
9fe5b5bf13 bectl(8): Use strcmp, rather than trying to directly compare 2018-08-12 00:09:52 +00:00
Kyle Evans
b6e7c421b7 libbe(3)/bectl(8): Standardize $FreeBSD$ IDs 2018-08-07 14:02:41 +00:00
Kyle Evans
709b553cd0 libbe(3): Check that dataset is to be mounted at / for be_exists
This makes the be_exists behavior match the comments that assert that we've
already checked that the dataset derived from the BE name is set to mount at
/.

Other changes of note:
- bectl_list sees another change; changing mountpoint based on mount status
  turns out to be a bad idea, so instead make the mounted property of the
  returned nvlist the path that it's mounted at

- Always return the "mountpoint" property in "mountpoint" if it's ste
2018-08-07 03:07:54 +00:00
Kyle Evans
9c65c7fb48 bectl(8): Only show mountpoint if the dataset is actually mounted
This is to accomodate a later change in libbe(3) that will always return the
mountpoint, whether it be the directory the dataset is actively mounted at
or the "mountpoint" property.
2018-08-07 03:01:04 +00:00
Kyle Evans
526ad58e80 bectl(8): Split list functionality out into its own file as well 2018-08-06 03:41:52 +00:00