unitrunker:base-upgrade

This is an old revision of the document!


Base Upgrade

ZFS Boot Environments or “BE”s can cover this. Make drastic changes inside one BE while leaving another clean BE as a fallback should things go awry. It is important to understand the BEs are separate from each other in that changes to one BE has no effect on the others. You can create two identical BEs A and B. If you edit a file on BE “A” and switch to “B” - those edits aren't available in “B”. Likewise, you can delete a file in “B”, switch to “A”, and the file still appears on “A”.

Obviously, you must have installed FreeBSD with ZFS as the boot partition to make use of BEs.

The ZFS command 'bectl' combined with judicious use of 'reboot' is all you need to manage BEs. The work flow becomes:

  • Create a new BE.
  • Switch to the new BE.
  • Make changes inside the BE.
  • Test drive the BE.
    • Happy? Keep the BE.
    • Unhappy? Switch back to an untainted or relatively pristine BE to start over.

Be sure to create and activate a new BE when it is time to do a major upgrade of the base system. For example, to upgrade from 12.1-RELEASE to 12.2-RELEASE …

# bectl list
(verify your active BE is named 'default')
# bectl rename default 12.1-RELEASE
# bectl create 12.2-RELEASE
# bectl activate 12.2-RELEASE
# reboot
(log back in as root)
# freebsd-update -r 12.2-RELEASE upgrade
# freebsd-update install
# reboot

Suppose things didn't go well after the reboot. You're pressed for time so you decide to delay the upgrade so you can take time to study the problem. No worries.

# bectl activate 12.1-RELEASE
# bectl reboot

Now you are back to where you left off before attempting the upgrade. Log back in as root to clean up the broken BE.

# bectl list
(verify the exact spellings of the BEs)
# bectl destroy 12.2-RELEASE

A few weeks later, you read that a patch has been made that might solve the problem you ran into. You decide to try again. Go back to the beginning of this page and start over. Good luck.

Suppose your upgrade went smoothly. After a few days or weeks when certain you no longer need the old 12.1-RELEASE BE, you can delete the old BE to save some disk space.

# bectl list
(verify the exact spellings of the BEs)
# bectl destroy 12.1-RELEASE
  • unitrunker/base-upgrade.1596081167.txt.gz
  • Last modified: 2020/07/30 03:52
  • by unitrunker