From owner-freebsd-fs@FreeBSD.ORG Mon Sep 5 21:04:02 2011 Return-Path: Delivered-To: freebsd-fs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CCBAE1065674 for ; Mon, 5 Sep 2011 21:04:02 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mail.vx.sk (mail.vx.sk [IPv6:2a01:4f8:100:1043::3]) by mx1.freebsd.org (Postfix) with ESMTP id 544428FC14 for ; Mon, 5 Sep 2011 21:04:02 +0000 (UTC) Received: from core.vx.sk (localhost [127.0.0.1]) by mail.vx.sk (Postfix) with ESMTP id 4AFF919B2E9; Mon, 5 Sep 2011 23:04:01 +0200 (CEST) X-Virus-Scanned: amavisd-new at mail.vx.sk Received: from mail.vx.sk ([127.0.0.1]) by core.vx.sk (mail.vx.sk [127.0.0.1]) (amavisd-new, port 10024) with LMTP id NSw0VF2LA6IR; Mon, 5 Sep 2011 23:03:59 +0200 (CEST) Received: from [10.9.8.1] (188-167-78-15.dynamic.chello.sk [188.167.78.15]) by mail.vx.sk (Postfix) with ESMTPSA id 18E0619B2DE; Mon, 5 Sep 2011 23:03:58 +0200 (CEST) Message-ID: <4E65393F.9070401@FreeBSD.org> Date: Mon, 05 Sep 2011 23:03:59 +0200 From: Martin Matuska User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.1) Gecko/20110830 Thunderbird/6.0.1 MIME-Version: 1.0 To: Jeremie Le Hen References: <20110905195458.GA7863@felucia.tataz.chchile.org> In-Reply-To: <20110905195458.GA7863@felucia.tataz.chchile.org> X-Enigmail-Version: 1.3.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-fs@FreeBSD.org Subject: Re: Difficulties to use ZFS root: ROOT MOUNT ERROR X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2011 21:04:03 -0000 On 5. 9. 2011 21:54, Jeremie Le Hen wrote: > Hi list, > > I've followed the instructions documented here: > http://wiki.freebsd.org/RootOnZFS/ZFSBootPartition > > The kernel starts correctly so this rules out any problem regarding > boot0, zfsboot and ZFS loader. > > But when the kernel tries to mount the root filesystem, it fails with > the following output: > > % Trying to mount root from zfs:zroot > % ROOT MOUNT ERROR: > % If you have invalid mount options, reboot, and first try the following from > % the loader prompt: > % > % set vfs.root.mountfrom.options=rw > % > % and then remove the invalid mount options from /etc/fstab. > % > % Loader variables: > % vfs.root.mountfrom=zfs:zroot > % vfs.root.mountfrom.options=rw > > >From a netboot'd FreeBSD: > > # zfs import zroot > % # zpool get bootfs zroot > % NAME PROPERTY VALUE SOURCE > % zroot bootfs zroot local > % > % # zfs list -o name,canmount,mountpoint > % NAME CANMOUNT MOUNTPOINT > % zroot on legacy > % zroot/tmp on /tmp > % zroot/usr on /usr > % zroot/usr/home on /usr/home > % zroot/usr/ports on /usr/ports > % zroot/usr/ports/distfiles on /usr/ports/distfiles > % zroot/usr/ports/packages on /usr/ports/packages > % zroot/usr/src on /usr/src > % zroot/usr/src8 on /usr/src8 > % zroot/var on /var > % zroot/var/crash on /var/crash > % zroot/var/db on /var/db > % zroot/var/db/pkg on /var/db/pkg > % zroot/var/empty on /var/empty > % zroot/var/log on /var/log > % zroot/var/mail on /var/mail > % zroot/var/run on /var/run > % zroot/var/tmp on /var/tmp > % # zfs export zroot > > /boot/zfs/zpool.cache exists in the zroot filesystem: > > % # zpool import -R /mnt zroot > % # zfs set mountpoint=/ zroot > % # ls -l /mnt/boot/zfs/zpool.cache > % -rw-r--r-- 1 root wheel 924 Sep 5 07:31 /mnt/boot/zfs/zpool.cache > % # grep zfs /mnt/boot/loader.conf /mnt/etc/rc.conf > % /mnt/boot/loader.conf:zfs_load="YES" > % /mnt/boot/loader.conf:vfs.root.mountfrom="zfs:zroot" > % /mnt/etc/rc.conf:zfs_enable="YES" > > > Any idea why this error occurs? > > Thanks It might be a problem in the zpool.cache. If you read the zpool(8) manpage properly, you will find this: -R root Equivalent to "-o cachefile=none,altroot=root" If you mount a pool with an alternate root and want to update the cachefile, you have to explicitly state the cachefile. (e.g. zpool import -o altroot=/mnt -o cachefile=/tmp/zpool.cache zroot) Second, you should not have an exported pool for booting (from viewpoint of target system's zfs.cache). Third, you don't need a legacy mount for zroot. You can leave it to "/" but you don't have to. I personally prefer having everyting one level deeper (e.g. pool/root, pool/root/var, etc.). Therefore I suggest: zpool import -o altroot=/mnt -o cachefile=/tmp/zpool.cache zroot zfs set mountpoint=/ zroot cp /tmp/zpool.cache /mnt/boot/zfs/zpool.cache shutdown -r now (as you can see I have not exported the pool) P.S: mfsBSD is your friend here - http://mfsbsd.vx.sk -- Martin Matuska FreeBSD committer http://blog.vx.sk