Root-on-ZFS upgrade question

Matthew Seaman m.seaman at infracaninophile.co.uk
Sat Nov 1 10:25:20 UTC 2014


On 31/10/2014 22:14, Darren Pilgrim wrote:
> If I have a running FreeBSD 9.x system, can I use 10.0 install media and
> the by-hand approach outlined in the RootOnZFS wiki page to install 10.0
> in parallel to the running 9.x then boot into the new OS?  I'm asking if
> I can do it this way because the current OS is 9-stable and I want to
> switch over to 10.0-RELEASE stock so I can make use of freebsd-update
> from official repos going forward.  The basic process would be:
> 
> 1. download and vnode mount 10.0 install media
> 2. set up the new tank/osroot10 tree
> 3. chroot and install OS and bootblocks as usual
> 4. exit chroot, migrate etc things
> 5. reboot into rescue media and change mountpoints
> 6. reboot into new OS
> 7. curse at myself because I forgot that one setting in that one file I
> touched once years ago and didn't note in the logbook
> 7a. repeat last step as necessary
> 7b. promise to self to be more diligent with the admin logbook THIS TIME
> I SWEAR FUH REALS
> 
> I don't see anything in the wiki page that would pose a problem.
> Amazingly, I was smart enough way back when that I installed the current
> OS into a data subset, not the ZFS root, so I think the only extra step
> I need is the extra reboot to move the / mount.
> 
> Am I overlooking anything?

You've a 9.x system already running on ZFS?  Than, yes, you're
overlooking a very big thing.  Boot environments.

If your 9.x setup is not already setup for boot environments, then it's
not too had to convert it.  Essentially it is a matter of creating a
zpool/ROOT zfs heirarchy and moving the zfses that contain your system
to something like zpool/ROOT/9.2-RELEASE -- you need to be careful of
the mountpoint and canmount properties while doing that, but by liberal
application of commands like 'zfs rename -u zroot/foo
zroot/ROOT/9.2-RELEASE/foo' (note the -u flag) it should even be
possible to do with the system still running.

Once you've got everything laid out in a BE friendly way, install
sysutils/beadm.  'beadm list' should show your existing system.  But now
you can do something like this:

    # beadm create 10.1-RELEASE
    # beadm mount 10.1-RELEASE /mnt
    # mount -t devfs devfs /mnt/dev
    # chroot /mnt

So now you're in a copy of you existing system -- it's a ZFS clone so
avoids unnecessary duplication of disk blocks and is generally space
efficient.

If your original system had been maintained via freebsd-update(8) you
could just use that to upgrade to 10.1-RELEASE in place -- when it tells
you to reboot, just run freebsd-update again.

Given you haven't been using freebsd-update(8), you can use the bit of
the RootOnZFS instructions about extracting the contents of the OS from
the install media to overwrite what's in your new boot environment.
However, this will scribble all over your local settings in /etc -- but
never fear, you still have a copy in your original system that you can
recover everything from.

You can also upgrade all your installed packages etc.  Once everything
is prepared, type 'exit' to get back to your main system, and:

    # umount /mnt/dev
    # beadm umount 10.1-RELEASE
    # beadm activate 10.1-RELEASE

and reboot.  Et voilà one system running 10.1.  If there's any problem,
you can revert to your 9.x system just by 'beadm activate 9.2-RELEASE'
and rebooting.  It's possible to switch to a different boot environment
from the loader prompt, or by booting from the install media should you
need to -- this is something that they want to add support for to the
boot menu screens but that hasn't happened yet, so the process is a bit
user unfriendly right now.

For more detail, see this thread on the forums:

https://forums.freebsd.org/threads/howto-freebsd-zfs-madness.31662/

It's quite a long thread, but it bears reading through it, as there's
lots of good stuff there.

Note: when using this scheme it is important *not* to apply any zpool or
zfs updates until you are sure that you will never need to boot into one
of your older boot environments again.  You only ever need to update
boot blocks when you upgrade zfs or zpool versions, so avoid that too
until you're ready to commit to the latest versions.  (I can't remember
if there are any updates like that for the 9.x -> 10.1 upgrade though.
Maybe.  Maybe not.)

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.

PGP: http://www.infracaninophile.co.uk/pgpkey
JID: matthew at infracaninophile.co.uk

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 971 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20141101/746f49b3/attachment.sig>


More information about the freebsd-questions mailing list