From owner-freebsd-questions@freebsd.org Mon Mar 19 02:59:24 2018 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 948B9F6A675 for ; Mon, 19 Mar 2018 02:59:24 +0000 (UTC) (envelope-from vas@mpeks.tomsk.su) Received: from relay2.tomsk.ru (mail.sibptus.tomsk.ru [212.73.124.5]) by mx1.freebsd.org (Postfix) with ESMTP id 95E99746BB for ; Mon, 19 Mar 2018 02:59:22 +0000 (UTC) (envelope-from vas@mpeks.tomsk.su) X-Virus-Scanned: by clamd daemon 0.98.5_1 for FreeBSD at relay2.tomsk.ru Received: from [212.73.125.240] (HELO admin.sibptus.transneft.ru) by relay2.tomsk.ru (CommuniGate Pro SMTP 5.1.16) with ESMTPS id 39958251 for freebsd-questions@freebsd.org; Mon, 19 Mar 2018 08:54:27 +0600 Received: from admin.sibptus.transneft.ru (sudakov@localhost [127.0.0.1]) by admin.sibptus.transneft.ru (8.15.2/8.15.2) with ESMTP id w2J2xHUd057967 for ; Mon, 19 Mar 2018 09:59:19 +0700 (+07) (envelope-from vas@mpeks.tomsk.su) Received: (from sudakov@localhost) by admin.sibptus.transneft.ru (8.15.2/8.15.2/Submit) id w2J2xFH7057960 for freebsd-questions@freebsd.org; Mon, 19 Mar 2018 09:59:15 +0700 (+07) (envelope-from vas@mpeks.tomsk.su) X-Authentication-Warning: admin.sibptus.transneft.ru: sudakov set sender to vas@mpeks.tomsk.su using -f Date: Mon, 19 Mar 2018 09:59:14 +0700 From: Victor Sudakov To: freebsd-questions@freebsd.org Subject: Solved. Re: Dualboot and ZFS Message-ID: <20180319025914.GA57490@admin.sibptus.transneft.ru> References: <20180115125241.GB60956@admin.sibptus.transneft.ru> <20180115144747.GA65526@admin.sibptus.transneft.ru> <20180115151526.GA66342@admin.sibptus.transneft.ru> <20180116034929.GB89443@admin.sibptus.transneft.ru> <20180131082738.GA46395@admin.sibptus.transneft.ru> <547e65d16ef16667f61d88463ca73079@roundcube.fjl.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <547e65d16ef16667f61d88463ca73079@roundcube.fjl.org.uk> Organization: AO "Svyaztransneft", SibPTUS X-PGP-Key: http://www.dreamwidth.org/pubkey?user=victor_sudakov X-PGP-Fingerprint: 10E3 1171 1273 E007 C2E9 3532 0DA4 F259 9B5E C634 User-Agent: Mutt/1.9.3 (2018-01-21) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2018 02:59:24 -0000 On 2018-01-31 08:27, Victor Sudakov wrote: > > My pool works successfully in a bhyve environment, but in VirtualBox > > 5.0.14 > > (to test the real boot sequence) I get this message from zfsboot: > > > > zfsboot: No ZFS pools located, can't boot > > > > However, if I boot from LiveCD, the pool is there, it's healthy and > > can be imported. Finally, and thanks to Eugene Grossbein, the problem is solved. The gist of the problem was the presence of a BSD label in the slice where the bootable zfs pool was located. It turns out that zfsboot ignores the slice if it finds a BSD label therein. The bootable zpool should be directly on the slice (like on da1s1, and not da1s1a). This means that both zfsboot(8) and the articles in the FreeBSD wiki are erroneous because they all suggest "gpart create -s BSD ada0s1" - in fact, it's fatal. Below is the final working example: ================================================ #!/bin/sh sysctl kern.geom.debugflags=0x10 DISK=da1 POOL="zroot-test3" NEWSYSTEM=newsystem SLICE=2 partition() { gpart create -s mbr ${DISK} gpart add -t fat32 -s 1G ${DISK} gpart add -t freebsd -s 2G -i ${SLICE} ${DISK} gpart set -a active -i ${SLICE} ${DISK} } bootcode() { gpart bootcode -b /boot/boot0 ${DISK} dd if=/boot/zfsboot of=/dev/${DISK}s${SLICE} count=1 dd if=/boot/zfsboot of=/dev/${DISK}s${SLICE} iseek=1 oseek=1024 } zfscreate() { zpool create -m none -R /${NEWSYSTEM} ${POOL} ${DISK}s${SLICE} zfs create -o mountpoint=none ${POOL}/ROOT zfs create -o mountpoint=/ ${POOL}/ROOT/default zfs create -o mountpoint=/usr -o canmount=off ${POOL}/usr zfs create -o mountpoint=/var -o canmount=off ${POOL}/var zfs create -o mountpoint=/tmp ${POOL}/tmp zfs create -o mountpoint=/usr/home ${POOL}/usr/home zfs create -o mountpoint=/var/audit ${POOL}/var/audit zfs create -o mountpoint=/var/crash ${POOL}/var/crash zfs create -o mountpoint=/var/log ${POOL}/var/log zfs create -o mountpoint=/var/mail ${POOL}/var/mail zfs create -o mountpoint=/var/tmp ${POOL}/var/tmp zfs create -V 1G -o org.freebsd:swap=on ${POOL}/swap zpool set bootfs=${POOL}/ROOT/default ${POOL} } clone() { cd /${NEWSYSTEM} || exit 3 #sleep 10 dump -0af - / | restore -ryf - || exit 3 mv etc/fstab etc/fstab.bak echo '# empty' > etc/fstab echo 'zfs_enable="YES"' >> etc/rc.conf.local echo 'zfs_load="YES"' >> boot/loader.conf cd /root } zfsexport() { zpool export ${POOL} } partition bootcode zfscreate clone zfsexport ================================================ -- Victor Sudakov, VAS4-RIPE, VAS47-RIPN AS43859