Based on ZFS snapshots & clones. Allows kind of Factory-reset.
bootclone command helps managing bootable snapshot clones.
GNOS Core will automatically create a bootclone named
factory-core, it can be used for repair & maintenance operations as a rescue shell.
Also a snapshot named
factory-install will be created once the installer terminates, it can be made bootable using
sudo bootclone create factory pool/root/gnos@factory-install
A ZFS clone persists changes, if you want to reset it you have to delete it (without
-s option) and create it back from its origin.
bootclone list # here you will notice ORIGIN is pool/root/gnos@factory-core bootclone delete gnos-factory-core bootclone create gnos-factory-core pool/root/gnos@factory-core
ZFS_DATA_DSET and all datasets with a defined mountpoint will be mounted, whatever bootclone you boot.
BOOTCLONE in Configuration file format / Storage_options.
USAGE: list create NAME [SRC] Create clone, SRC supports @snapshot delete [-s] NAME Delete clone and origin detach [-s] NAME Detach clone from origin update Update managed grub.cfg help Help OPTIONS: -s Also delete origin snapshot FILES: /etc/bootclone.conf Configuration $BOOTCLONE_MNTP/grub/grub.cfg Managed grub configuration $BOOTCLONE_MNTP/grub/bootclone-head.cfg Managed grub header template $BOOTCLONE_MNTP/grub/bootclone-foot.cfg Managed grub footer template CONFIG: $BOOTCLONE_TYPE "zfs" OR "ext" $BOOTCLONE_ROOT Root-repo dataset, relative to root pool $BOOTCLONE_MNTP Grub-boot mountpoint $BOOTCLONE_HEAD Grub header, relative to $BOOTCLONE_MNTP $BOOTCLONE_FOOT Grub footer, relative to $BOOTCLONE_MNTP $BOOTCLONE_BOOT [ext-only] Boot-repo path, relative to $BOOTCLONE_MNTP
SRC is a root ZFS dataset, eg
pool/root/gnos, if omitted, a snapshot of the current state will be created.
# Bootable clone from current state sudo bootclone create my-1st-bootclone # Bootable clone from previously saved state sudo bootclone create my-2nd-bootclone pool/root/gnos@my-1st-bootclone
At boot, if you use
CRYPTO_ROOT without a plain boot partition, you have to unlock the pool first.
Esc to enter the grub menu, it will automatically include a menu entry for the bootclone.
Select the target bootclone and press
Enter, then you can press
Esc again to enter the bootclone’s grub menu.
To tweak the 1st level grub menu:
# Check config cat /etc/bootclone.conf # Mount 1st level grub: `$BOOTCLONE_MNTP` sudo mount /mnt/bootclone-boot # Edit `$BOOTCLONE_MNTP/$BOOTCLONE_HEAD` or `$BOOTCLONE_MNTP/$BOOTCLONE_FOOT` # Update 1st level grub sudo bootclone update