Playing with ZFS boot on Nexenta

I recently wrote about the newly released NexentaCP. One of the new great features is the integrated ZFS boot in the installer. You can now get a ZFS boot capable system with no work at all.

The default installation of Nexenta will create a ZFS pool called syspool and your root file system will be called syspool/rootfs. In this article I will show you how to clone this filesystem and boot from the clone instead. ZFS boot will be used a lot in the future and it may be wise to learn about it in its early stages as well.

First we need to snapshot and clone the file system. Using ZFS this is of course a very quick operation

# zfs snapshot syspool/rootfs@mysnapshot
# zfs clone syspool/rootfs@mysnapshot syspool/myrootfs

You need to set a few properties as well.


# zfs set mountpoint=legacy syspool/myrootfs

This will stop ZFS from automounting your filesystem and you have to take care of it yourself using /etc/vfstab. This is a requirement for ZFS boot.

Now we must to mount this new file system and change the vfstab so that it will mount the correct root file system upon boot.

# mount -F zfs syspool/myrootfs /mnt

The next step is to change /mnt/etc/vfstab so that the line that mounts the root file system looks like this

syspool/myrootfs - / zfs - no -

The final step before rebooting is to to tell grub which ZFS file system is our default boot file system.

# zpool set bootfs=syspool/myrootfs syspool

These are all the steps needed. All you have to do now is to reboot and syspool/myrootfs will be your file system.

If you want to back to your previous root file system you need to do a

# zpool set bootfs=syspool/rootfs syspool
# reboot

ZFS boot is going to be immensely useful when doing software upgrades. Think about the possibility to patch the system and if something goes wrong you can either rollback to the previous snapshot or boot from the clone. This is a feature which really separates OpenSolaris from the rest.

To get more information have a look at the ZFS boot information on OpenSolaris.org.

[?]
Do you need system administration assistance? If you like what you are reading please consider subscribing to the RSS feed. If you have feedback or if you find the article useful please leave a comment below.

Leave a Reply