Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Mar 2015 23:56:34 -0500 (CDT)
From:      Greg Rivers <gcr+freebsd-stable@tharned.org>
To:        freebsd-stable@freebsd.org
Subject:   Booting from ZFS
Message-ID:  <alpine.BSF.2.20.1503242331240.1843@angus.tharned.org>

next in thread | raw e-mail | index | archive | help
I'm trying to build a bootable ZFS system on a USB drive.  Using the 
procedure below results in the following error when I try to boot:

 	gptzfsboot: error 66 LBA 48
 	gptzfsboot: error 66 LBA 1
 	gptzfsboot: No ZFS pools located, can't boot

I'm using the dist files from the latest STABLE snapshot on a system 
running 10.1-STABLE r279968 amd64.  I've tried it with and without file 
system compression.  I found a similar report[1] in the FreeBSD Forums, 
but there was no conclusion to that posting.

What am I doing wrong?

[1] https://forums.freebsd.org/threads/freebsd-10-w-fresh-root-on-zfs-fails-to-boot.47651/#post-266106
---------------------------------------------------------------------------
#!/bin/ksh
set -x -e

DISK=diskid/DISK-4C530009730530116424
TMPDIR=/mnt

gpart destroy -F ${DISK} || :
gpart create -s GPT ${DISK}
gpart add -a 4k -s 512k -t freebsd-boot ${DISK}	# p1
gpart add -a 4k -s 1g -t freebsd-swap ${DISK}	# p2
gpart add -a 4k -t freebsd-zfs ${DISK}		# p3
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ${DISK}

sysctl vfs.zfs.min_auto_ashift=12
zpool create -o altroot=${TMPDIR} -m none -f syspool ${DISK}p3
zfs create -o mountpoint=none syspool/ROOT
zfs create -o mountpoint=/ -o compression=lz4 syspool/ROOT/default
zpool set bootfs=syspool/ROOT/default syspool
zfs create -o mountpoint=/var -o compression=lz4 syspool/var
zfs create -o mountpoint=/usr -o compression=lz4 syspool/usr
zfs create -o mountpoint=/home -o compression=lz4 syspool/home

for DIST in base kernel lib32 games doc
do
 	fetch -o - ftp://ftp.freebsd.com/pub/FreeBSD/snapshots/amd64/amd64/10.1-STABLE/${DIST}.txz | tar -C ${TMPDIR} -x -f -
done

cat <<\! >${TMPDIR}/boot/loader.conf
zfs_load="YES"
!
cat <<\! >${TMPDIR}/etc/rc.conf
zfs_enable="YES"
!
cat <<\! >${TMPDIR}/etc/fstab
# Device	Mountpoint	FStype		Options	Dump	Pass#
/dev/da0p2	none		swap		sw	0	0
tmpfs		/tmp		tmpfs		rw	0	0
procfs		/proc		procfs		rw	0	0
fdescfs		/dev/fd		fdescfs		rw	0	0
!

zpool export syspool
---------------------------------------------------------------------------
-- 
Greg Rivers



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.20.1503242331240.1843>