ZFS on root: / is found but child datasets are not mounted

Jeremie Le Hen jeremie at le-hen.org
Sun Sep 18 09:27:33 UTC 2011


Hi,

Please Cc: me when replying.

I bought a new HDD in order to mirror the system disk.  This is also a
great opportunity to migrate the root filesystem to ZFS.

I followed mm@'s advice from another thread: "having everything one
level deeper".  That is zroot/root is "/".

The kernel boots fine, it finds the root filesystem, but fails miserably
when running rc.d scripts because child datasets are not mounted (/var,
/usr, ...).

FWIW, I escaped to DDB and typed "show mount".  Besides /dev, / was
indeed mounted from zoot/root and /tmp was /dev/md0 for an unknown
reason.

I've been fiddling this for 3 hours yesterday without luck.  Does anyone have
an idea on this please?

More information:

obiwan:~# zpool import -o altroot=/mnt -o cachefile=/tmp/zpool.cache zroot

obiwan:~# zpool list zroot
NAME    SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
zroot   147G  2.34G   145G     1%  1.00x  ONLINE  /mnt

obiwan:~# zpool status zroot
  pool: zroot
 state: ONLINE
 scan: none requested
config:

        NAME                                          STATE     READ WRITE CKSUM
        zroot                                         ONLINE       0     0     0
          gptid/080c18f8-c2d2-11e0-baa0-00151724749a  ONLINE       0     0     0

errors: No known data errors

obiwan:~# zpool get all zroot
NAME   PROPERTY       VALUE             SOURCE
zroot  size           147G              -
zroot  capacity       1%                -
zroot  altroot        /mnt              local
zroot  health         ONLINE            -
zroot  guid           12889954819379028468  default
zroot  version        28                default
zroot  bootfs         zroot/root        local
zroot  delegation     on                default
zroot  autoreplace    off               default
zroot  cachefile      /tmp/zpool.cache  local
zroot  failmode       wait              default
zroot  listsnapshots  off               default
zroot  autoexpand     off               default
zroot  dedupditto     0                 default
zroot  dedupratio     1.00x             -
zroot  free           145G              -
zroot  allocated      2.34G             -
zroot  readonly       off               -


obiwan:~# cp /tmp/zpool.cache /mnt/boot/zfs/zpool.cache
obiwan:~# grep 'zfs[:_]' /mnt/boot/loader.conf 
zfs_load="YES"
vfs.root.mountfrom="zfs:zroot/root"

obiwan:~# zfs list -o name,mounted,canmount,mountpoint -r zroot | grep -v /mnt/jails
NAME                              MOUNTED  CANMOUNT  MOUNTPOINT
zroot                                  no        on  none
zroot/root                            yes        on  /mnt
zroot/root/root                       yes        on  /mnt/root
zroot/root/tmp                        yes        on  /mnt/tmp
zroot/root/usr                        yes        on  /mnt/usr
zroot/root/usr/local                  yes        on  /mnt/usr/local
zroot/root/usr/obj                    yes        on  /mnt/usr/obj
zroot/root/usr/pkgsrc                 yes        on  /mnt/usr/pkgsrc
zroot/root/usr/pkgsrc/distfiles       yes        on  /mnt/usr/pkgsrc/distfiles
zroot/root/usr/ports                  yes        on  /mnt/usr/ports
zroot/root/usr/ports/distfiles        yes        on  /mnt/usr/ports/distfiles
zroot/root/usr/ports/packages         yes        on  /mnt/usr/ports/packages
zroot/root/usr/src                    yes        on  /mnt/usr/src
zroot/root/var                        yes        on  /mnt/var
zroot/root/var/crash                  yes        on  /mnt/var/crash
zroot/root/var/db                     yes        on  /mnt/var/db
zroot/root/var/db/pkg                 yes        on  /mnt/var/db/pkg
zroot/root/var/empty                  yes        on  /mnt/var/empty
zroot/root/var/log                    yes        on  /mnt/var/log
zroot/root/var/mail                   yes        on  /mnt/var/mail
zroot/root/var/run                    yes        on  /mnt/var/run
zroot/root/var/tmp                    yes        on  /mnt/var/tmp

Thanks.
Regards,
-- 
Jeremie Le Hen

Men are born free and equal.  Later on, they're on their own.
				Jean Yanne


More information about the freebsd-fs mailing list