Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Sep 2009 12:45:16 +0100
From:      krad <kraduk@googlemail.com>
To:        freebsd-current@freebsd.org
Subject:   make world on a zfs system
Message-ID:  <d36406630909270445l2307186ej52f0b248b224d9e6@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
HI,

I have a pure zfs system at home, and was interested in how most others are
implementing theirs with regard to the os installation.

Most of the guides I have seen have a zpool eg system made up of
mirrored/raided vdevs, but they usually install the os on the root zfs fs
for that pool, and have that in loader.conf

eg

vfs.root.mountfrom="zfs:system"

I have done this slightly differently on my system. I initially installed
onto /system/root. Therefore my loader.conf has the following line

vfs.root.mountfrom="zfs:system/root"

Nothing special there. However this next bit is the cool bit.

Next time i want to upgrade the os i do one of the following


zfs snapshot system/root@20090926

# if i want speed
zfs clone system/root@20090926 system/root_20090926

#  or better way but a bit slower (2-3 mins)
zfs send system/root@20090926 | zfs receive system/root_20090926

I tend to use the send and receive, as disk space isn't really an issue and
I dont like having the dependency that you clones as it makes it more
complicated to delete old file systems.

Now lets install the new os


zfs set mountpoint=legacy system/root_20090926
mount -t zfs system/root_20090926 /mnt
sed -i -e "system\/root\"/system\/root_20090926\"/" /mnt/boot/loader.conf
export DESTDIR=/mnt
cd /usr/src
make installkernel && make installworld
zpool set bootfs=system/root_20090926 system
mergmaster
init 6

The system will now boot onto the new filesystem. If there is a problem I
can just boot in with my rescue usb stick and flip the bootfs flag back and
bang im back in the old os.

Why not just use snapshots I hear you say. Well if I roll back the os I have
lost the new stuff I have installed. This is ok in terms of getting the os
back up. However in terms of getting the new installation fixed this isn't
much help. This way I can flip flop back and two between the installations.
This could be ideal for people who want to have a quick look at current
every now and again. It would be really cool if this type of thing could get
integrated into the make world scripts.

Before anyone points out I did steal this idea from opensolaris.

Ideally  I need to do is see if I can get something built into beastie, to
choose the bootfs for the pool. I'm not sure this is viable, as once you
have started to load the loader, you must have chosen the bootfs. Has anyone
looked at this already and can they offer any advice?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d36406630909270445l2307186ej52f0b248b224d9e6>