From owner-freebsd-questions@FreeBSD.ORG Sat May 5 06:19:19 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E91CE106564A; Sat, 5 May 2012 06:19:19 +0000 (UTC) (envelope-from vermaden@interia.pl) Received: from smtpo.poczta.interia.pl (smtpo.poczta.interia.pl [217.74.65.208]) by mx1.freebsd.org (Postfix) with ESMTP id 992E88FC0C; Sat, 5 May 2012 06:19:19 +0000 (UTC) Date: Sat, 05 May 2012 08:19:11 +0200 From: vermaden To: "Randal L. Schwartz" X-Mailer: interia.pl/pf09 In-Reply-To: <86y5p7y478.fsf@red.stonehenge.com> References: <86ipgbg2p6.fsf@red.stonehenge.com> <86d36jzk16.fsf@red.stonehenge.com> <867gwrzjwc.fsf@red.stonehenge.com> <86397fzjgi.fsf@red.stonehenge.com> <86y5p7y478.fsf@red.stonehenge.com> Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=interia.pl; s=biztos; t=1336198752; bh=ELWlNuaKv6qUCefZMYhpd+3kaDYMW+4fuFIxYHPNiuI=; h=Date:From:Subject:To:Cc:X-Mailer:In-Reply-To:References: Message-Id:MIME-Version:Content-Type:Content-Transfer-Encoding; b=KYkkF0Y4PMIMK9cxSUonc9dwZy2XW7zhb2+JNZRzTJPZDHwKt8vbzVtWOeCq/VDjG Q24ylYfzmrIIDubW3OSj9DP3VrjS4ILugsi7D/84hEL3NjTl9OmyWBqyzqJ1e/3kPJ ncILyzoqK813fjNbs0YoPJsv/yh1TVUPfD/LkXHY= Cc: freebsd-fs@FreeBSD.org, freebsd-questions@freebsd.org, bryan@shatow.net Subject: Re: HOWTO: FreeBSD ZFS Madness (Boot Environments) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 May 2012 06:19:20 -0000 > And no difference on 8.3 :( >=20 > Should there have been a "promote" in there somewhere? It looks like > the boot env is still dependent on the very old zroot. Hi, I have just recreated from scratch Your zroot root setup under VirtualBox and tested it deeply. There was an interesting BUG in the *beadm* utility, or maybe it is a BUG in sh(1), I do not have that good knowledge of POSIX/sh(1) standards. To the point, check these two code snippets, they should do EXACLY the same, logic is the same, the differece is only the syntax. snippet 1: [ ${MOUNT} -eq 0 ] && { zfs set mountpoint=3D${TMPMNT} ${POOL}/ROOT/${2} zfs mount ${POOL}/ROOT/${2} } || { TMPMNT=3D${MOUNT} } snippet 2: if [ ${MOUNT} -eq 0 ]; then zfs set mountpoint=3D${TMPMNT} ${POOL}/ROOT/${2} zfs mount ${POOL}/ROOT/${2} else TMPMNT=3D${MOUNT} fi But unfortunately, it comes out that its not the same ... [ ${MOUNT} -eq 0 ] && { zfs set mountpoint=3D${TMPMNT} ${POOL}/ROOT/${2} zfs mount ${POOL}/ROOT/${2} # IF THIS LINE ABOVE FAILS (NOT RETURN 0) THEN # TMPMNT=3D${MOUNT} BELOW WILL BE EXECUTED } || { TMPMNT=3D${MOUNT} } The sollution can be put command that will always work (return 0 on exit) like that: [ ${MOUNT} -eq 0 ] && { zfs set mountpoint=3D${TMPMNT} ${POOL}/ROOT/${2} zfs mount ${POOL}/ROOT/${2} echo 1> /dev/null 2> /dev/null } || { TMPMNT=3D${MOUNT} } ... or to rewrite it under if/then/else which I did for the whole *beadm* utility and I no longer use || and && syntax, anywhere. As for Your problems, this worked for me on this VirtualBox test environment. # zfs promote zroot # zfs rollback zpool@be # zfs set mountpoint=3D/mnt zroot [ set vfs.root.mountfrom=3D"zfs:zroot" in /mnt/boot/loader.conf ] # zpool set bootfs=3Dzroot zroot # zfs set mountpoint=3Dnone zroot # reboot These above should bring back to the start point before You entered my instructions to try *beadm* and BEs. After reboot ... # zfs destroy -R zroot/ROOT # zfs create -o mountpoint=3Dnone zroot/ROOT # zfs send zpool@be | zfs recv zroot/ROOT/be # fetch https://raw.github.com/vermaden/beadm/master/beadm # chmod +x beadm # ./beadm list # ./beadm activate be # reboot Now You should have a working system with boot environments. Both GitHub and SourceForce have the latest fixed *beadm* version. Regards, vermaden --=20 ...