make world on a zfs system

krad kraduk at googlemail.com
Sun Sep 27 11:45:18 UTC 2009


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 at 20090926

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

#  or better way but a bit slower (2-3 mins)
zfs send system/root at 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?


More information about the freebsd-current mailing list