[ZFS] fail to mount root from ZFS in ZFS-only booting

Sunpoet Hsieh sunpoet at gmail.com
Thu Apr 7 17:42:50 UTC 2011


Howdy,

I've done moving my machine from UFS to ZFS using mfsBSD (v28 special
edition) [1].
It provides "zfsinstall" [2] script to simplify the steps.
Í've compared it with other "Root on ZFS using GPT" documents [3][4]
and they are compatible.

I created zpool using 4 disks (ada0-ada3).
However, it cannot boot from ZFS now.

The zfs pool setting:
- v28, raidz1 (ada0-ada3)
- pool name: IRIS
- ada*p1: gpart add -t freebsd-boot -s 128
  ada*p2: gpart add -t freebsd-swap -s 2G
  ada*p3: gpart add -t freebsd-zfs
- root: IRIS/root

My steps are as follows:
1. Boot from mfsBSD
   mount -t cd9660 /dev/acd0 /cdrom
   zfsinstall -d ada0 -d ada1 -d ada2 -d ada3 -t
/cdrom/8.2-RELEASE-amd64.tar.xz -s 2G -p IRIS
   remove the disc and boot from harddisk
2. update src tree (tag: RELENG_8)
   apply mm@'s v28 patch [5]
   make kernel, world and mergemaster
   gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0..ada3
   shutdown, attach datadisk (UFS) and power on
3. build ports and restore configuration files
   shutdown, detach datadisk (UFS) and power on
4. move data back (from UFS)
   shutdown, detach datadisk (UFS) and power on
5. I cannot boot from ZFS now!

The error message is:
  "Trying to mount root from zfs:IRIS/root
   start_init: trying /sbin/init"
or
  "MOUNT FROM ERROR:"
It seems the gptzfsboot fails to mount IRIS/root during boot process

I've tried the following tests.
1. In the boot prompt, "lsdev" shows zfs0
2. boot from mfsBSD and "zpool import IRIS". It's OK.
3. zpool get bootfs IRIS0
   the result is "IRIS/root". It's correct.
4. When "MOUNT FROM ERROR:" occurs, "?" lists ada[0-3], ada[0-3]p[0-2]
and gptid/* but no zpool (IRIS).

I have no idea what happened.
Did I miss any steps to upgrade system?
Does anyone know how to solve this problem?
Thanks in advance!!

Regards,
sunpoet

/boot/loader.conf:
zfs_load="YES"
vfs.root.mountfrom="zfs:IRIS/root"

References:
[1] http://mfsbsd.vx.sk/
    http://mfsbsd.vx.sk/iso/mfsbsd-se-8.2-zfsv28-amd64.iso
[2] http://box.vx.sk/wsvn/mfsbsd/trunk/tools/zfsinstall
[3] http://wiki.freebsd.org/RootOnZFS/GPTZFSBoot/RAIDZ1
[4] http://www.keltia.net/howtos/zfsboot
[5] http://people.freebsd.org/~mm/patches/zfs/v28/stable-8-zfsv28-20110317.patch.xz


More information about the freebsd-fs mailing list