Date: Sun, 27 Oct 2019 20:02:44 +0000 From: Johannes Totz <johannes@jo-t.de> To: freebsd-fs@freebsd.org Subject: zpool attach/resilver trashes bsdlabel bootcode Message-ID: <qp4pkj$7f28$1@blaine.gmane.org>
next in thread | raw e-mail | index | archive | help
Hi there, how does a zpool attach and subsequent resilver deal with the bootcode that's inside a bsdlabel partition? I'm trying to create a bootable image (with mbr, slices, and partition) but every time I attach the partition to a pool the bootcode ends up garbled and the image is not bootable. For example: > /usr/bin/truncate -s 1025m /var/tmp/usbbootpoolimg.raw > /sbin/mdconfig -a -t vnode -u 3 -S 512 -y 16 -x 63 -f /var/tmp/usbbootpoolimg.raw > > /sbin/gpart create -s mbr /dev/md3 > /sbin/gpart add -s 1g -t freebsd /dev/md3 > /sbin/gpart set -a active -i 1 /dev/md3 > /sbin/gpart bootcode -b /boot/boot0 /dev/md3 > /sbin/gpart create -s bsd /dev/md3s1 > /sbin/gpart add -t freebsd-zfs /dev/md3s1 > > /sbin/bsdlabel -B /dev/md3s1 > /bin/dd if=/boot/zfsboot of=/var/tmp/zfsboot1 count=1 > /sbin/gpart bootcode -b /var/tmp/zfsboot1 /dev/md3s1 > /bin/dd if=/boot/zfsboot of=/dev/md3s1a skip=1 seek=1024 All good up to here. Image is bootable, but there is no pool yet in the image so the bootloader complains. Fine. Then: > /sbin/zpool attach bootpool gpt/boot2 /dev/md3s1a Now the freshly installed bootcode is trashed. If I try to boot this it makes it to the F1 boot prompt (the mbr part) but then hangs indefinitely. If I write the bootcode again, after the pool resilver is done then the image boots. To me, the bootcode is part of the partitioning scheme, not part of the pool that needs resilvering. Any ideas? Cheers, Johannes
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?qp4pkj$7f28$1>