Upgrading FreeBSd when using a zfs-only installation?

krad kraduk at gmail.com
Mon Mar 14 10:31:47 UTC 2011

On 14 March 2011 00:10, Andrew Moran <amoran at forsythia.net> wrote:

> I have successfully upgraded form FreeBSD 8.1 to FreeBSD 8.2.  Here were my
> steps:
> cvsup /root/stable-supfile
> cd /usr/src
> make buildworld
> make buildkernel
> make installkernel
> shutdown -r now
> *select single user mode*
> mount -u /
> zfs mount -a
> mergemaster -p
> make installworld
> mergemaster
> gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ad4
> gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ad5
> zpool upgrade -a
> zfs upgrade -a
> shutdown -r now
> NOTE 1:  the gpart commands are specific to my setup - I'm using a ZFS
> mirror on ad4 and ad5.    Your system may be different.
> NOTE 2:  my "zfs upgrade -a" ran out of swap space and died.  I ran "zfs
> upgrade" to see what filesystems were left un-upgraded and did those
> manually.
> Thanks Scott Ballantyne and everyone else who responded.
> Cheers!
> --Andy
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe at freebsd.org"

sorry this is a bit late but here is the update script I use. I basically
creates a structure like this. Makes if very easy to flip flop between os
installs by modifying the pool  bootfs variable

system-4k/be                              35.2G  1.20T   156K  /system-4k/be
system-4k/be/current                      1.22G  1.20T   740M  legacy
system-4k/be/root20110226                 2.80G  1.20T   882M  legacy
system-4k/be/root20110302                 3.24G  1.20T   882M  legacy
system-4k/be/root20110306                 1.32G  1.20T   882M  legacy
system-4k/be/root20110312                 1.36G  1.20T   923M  legacy
system-4k/be/tmp                           776K  1.21T   260K  /tmp
system-4k/be/usr-local                    2.84G  1.20T  2.47G  /usr/local/
system-4k/be/usr-obj                      5.08G  1.20T  2.09G  /usr/obj
system-4k/be/usr-ports                    5.82G  1.20T  4.33G  /usr/ports
system-4k/be/usr-ports/distfiles          1.20G  1.20T  1.19G
system-4k/be/usr-src                      1.49G  1.20T   973M  /usr/src
system-4k/be/var                          4.72G  1.21T   805M  /var
system-4k/be/var/log                      3.66G  1.21T  2.34G  /var/log
system-4k/be/var/mysql                    82.5M  1.21T  33.9M  /var/db/mysql


if [ $UID != 0 ] ; then
  echo your not root !! ; exit 1

date=`date '+%Y%m%d'`
oroot=`grep "vfs.root.mountfrom=\"zfs:system-4k/" /boot/loader.conf | sed -e
"s#^.*\"zfs:system-4k/be/##" -e "s#\"##"`

export DESTDIR=/$zpool/be/$nroot

if [ "$oroot" =  "$nroot" ] ; then
 echo "i cant update twice in one day"; exit 1

echo building in $zpool/be/$nroot

zfs snapshot $zpool/be/$oroot@$snap &&
zfs send $zpool/be/$oroot@$snap | zfs receive -vv $zpool/be/$nroot    &&
cd /usr/src &&
make installkernel &&
make installworld &&
sed -i -e "s#$zpool/be/$oroot#$zpool/be/$nroot#"
/$zpool/be/$nroot/boot/loader.conf && \
echo "Installing boot records.." &&
zpool status system-4k | grep -A 2 mirror | grep ad | sed -e "s/p[0-9]//"  |

        while read a b; do
                gpart bootcode -b /zfsboot/pmbr -p /zfsboot/gptzfsboot -i 1
        done &&
cp -v /zfsboot/zfsloader /$zpool/be/$nroot/boot/. &&
echo -en "\n\nNow run these two commands to make the changes live, and
 zfs set mountpoint=legacy $zpool/be/$nroot
 zpool set bootfs=$zpool/be/$nroot $zpool\n\n"

More information about the freebsd-questions mailing list