Difference between revisions of "Upgrading FreeBSD 12.2 to 13.0"

From Aram's Wiki
Jump to: navigation, search
(References)
(References)
Line 90: Line 90:
  
 
* [https://www.freebsd.org/releases/13.0R/relnotes/ FreeBSD 13.0-RELEASE Release Notes]
 
* [https://www.freebsd.org/releases/13.0R/relnotes/ FreeBSD 13.0-RELEASE Release Notes]
 +
* [https://www.freebsd.org/releases/13.0R/installation/ FreeBSD 13.0-RELEASE Installation Instructions]
 +
* [https://vermaden.wordpress.com/2021/02/23/upgrade-freebsd-with-zfs-boot-environments/ Upgrade FreeBSD with ZFS Boot Environments]
 
* [https://www.freebsd.org/cgi/man.cgi?query=freebsd-update&apropos=0&sektion=0&manpath=FreeBSD+12.2-RELEASE+and+Ports&arch=default&format=html freebsd-update(8)]
 
* [https://www.freebsd.org/cgi/man.cgi?query=freebsd-update&apropos=0&sektion=0&manpath=FreeBSD+12.2-RELEASE+and+Ports&arch=default&format=html freebsd-update(8)]
 
* [https://www.freebsd.org/cgi/man.cgi?query=geom&apropos=0&sektion=0&manpath=FreeBSD+12.2-RELEASE+and+Ports&arch=default&format=html geom(8)]
 
* [https://www.freebsd.org/cgi/man.cgi?query=geom&apropos=0&sektion=0&manpath=FreeBSD+12.2-RELEASE+and+Ports&arch=default&format=html geom(8)]
 
* [https://www.freebsd.org/cgi/man.cgi?query=gpart&apropos=0&sektion=0&manpath=FreeBSD+12.2-RELEASE+and+Ports&arch=default&format=html gpart(8)]
 
* [https://www.freebsd.org/cgi/man.cgi?query=gpart&apropos=0&sektion=0&manpath=FreeBSD+12.2-RELEASE+and+Ports&arch=default&format=html gpart(8)]

Revision as of 14:14, 15 April 2021


Introduction

We assume root on ZFS.

Everything on this page needs to be done as root, unless specified, so su to root.

su -

Upgrade base system

We will do the upgrade offline, in a new BE, so first, create the BE and mount it.

bectl create 13.0-RELEASE
bectl mount 13.0-RELEASE /mnt

Then run freebsd-update(8):

freebsd-update -b /mnt -d /mnt/var/db/freebsd-update -r 13.0-RELEASE upgrade
freebsd-update -b /mnt -d /mnt/var/db/freebsd-update install
freebsd-update -b /mnt -d /mnt/var/db/freebsd-update install
freebsd-update -b /mnt -d /mnt/var/db/freebsd-update install

Yes, you really need to run it that many times.

Upgrade the bootloader

BIOS

First, determine your boot devices.

z800:aram$ zpool status zroot
  pool: zroot
 state: ONLINE
  scan: scrub repaired 0B in 00:01:46 with 0 errors on Mon Feb  5 17:48:15 2018
config:

	NAME          STATE     READ WRITE CKSUM
	zroot         ONLINE       0     0     0
	  mirror-0    ONLINE       0     0     0
	    gpt/zfs0  ONLINE       0     0     0
	    gpt/zfs1  ONLINE       0     0     0

errors: No known data errors

Look for the devices in the GEOM output.

z800:aram$ geom -t
...
  da0                               PART       da0p3
   da0p3                           DEV       
   da0p3                           LABEL      gpt/zfs0
     gpt/zfs0                      DEV       
     zfs::vdev                     ZFS::VDEV 
...
  da2                               PART       da2p3
   da2p3                           DEV       
   da2p3                           LABEL      gpt/zfs1
     gpt/zfs1                      DEV       
     zfs::vdev                     ZFS::VDEV 
...

In our case, we need to install the new bootloader on da0 and da2.

gpart bootcode -b /mnt/boot/pmbr -p /mnt/boot/gptzfsboot -i 1 da0
gpart bootcode -b /mnt/boot/pmbr -p /mnt/boot/gptzfsboot -i 1 da2

EFI

TODO.

Upgrade the packages

It is unclear why we need devfs, but we need it:

mount -t devfs devfs /mnt/dev/
pkg -c /mnt update
pkg -c /mnt upgrade
unmount /mnt/dev/

Activate the new BE

bectl umount 13.0-RELEASE
bectl activate 13.0-RELEASE

And reboot. If it doesn't work, you can revert to another BE in the bootloader.

References