Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Dec 2016 13:33:17 +0100
From:      Dirk-Willem van Gulik <dirkx@webweaving.org>
To:        Allan Jude <allanjude@freebsd.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: ZFS and GPT boot - size issue bootblock v.s. default of sysinstall
Message-ID:  <10FC4055-5650-4C68-A07B-FBA7BF6BB60A@webweaving.org>
In-Reply-To: <068c90c2-61c0-2fbc-3984-0bc937e19d63@freebsd.org>
References:  <AB657A06-8886-4EA5-9323-92317707B039@webweaving.org> <068c90c2-61c0-2fbc-3984-0bc937e19d63@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

> On 28 Dec 2016, at 22:04, Allan Jude <allanjude@freebsd.org> wrote:
>=20
> On 2016-12-28 14:41, Dirk-Willem van Gulik wrote:
>> On a default ZFS install (late 2014, 10.x) of a few years hence it =
seems sysinstall selected 64k as the default size of partition 1: with =
the bootblock:
>>=20
>> sudo gpart show
>> =3D>        34  7814037101  ada0  GPT  (3.6T)
>>          34           6        - free -  (3.0K)
>>          40         128     1  freebsd-boot  (64K)
>>         168    67108864     2  freebsd-swap  (32G)
>>    67109032  7746928096     3  freebsd-zfs  (3.6T)
>>  7814037128           7        - free -  (3.5K)
>>=20
>> =E2=80=A6. lots of disks snipped =E2=80=A6..
>>=20
>> =3D>        34  7814037101  ada35  GPT  (3.6T)
>>          34           6        - free -  (3.0K)
>>          40         128     1  freebsd-boot  (64K)
>>         168    67108864     2  freebsd-swap  (32G)
>>    67109032  7746928096     3  freebsd-zfs  (3.6T)
>>  7814037128           7        - free -  (3.5K)
>>=20
>> Fair to assume that this (the 64k) is the reason that from 11.x =
onwards;=20
>>=20
>> 	gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0=20
>>=20
>> fails with an immediate:
>>=20
>> 	gpart: /dev/ada1p1: not enough space=20
>>=20
>> as gptzfsboot has grown in recent years to something towards the 90k =
mark ?
>>=20
>> 	-r--r--r-- 1 root wheel 88898 Dec 24 11:52 /boot/gptzfsboot
>> =09
>> And I guess avoiding a rebuild would mean something like gently =
disabling swap; shifting partition 1 & 2 carefully an so on ? Or is =
there a more clever way? ZFS has *already* been upgraded.
>>=20
>> Or am I missing something ?
>=20
> swapoff -a; gpart resize ...; swapon -a
>=20
> is likely your best bet.

Aye - indeed a

	#!/bin/sh

	# gen 0 35 | while read I

	camcontrol devlist | grep ada | awk -F, '{ print $2 }' | sed -e =
's/)//=E2=80=98 | while read I
	do
		gpart delete -i 2 ada$I
		gpart resize -i 1 -s 512k ada$I
		gpart add -t freebsd-swap -i 2 ada$I
		gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 =
ada$I
	done

solved the issue for all machines affected.=20

We=E2=80=99ve since spotted quite a few systems with too small a =
bootblock - so I guess sysinstall has historically been a bit stingy - =
and it may be an idea to include something like above logic in man-page =
or the upgrade logic.

> The other option is to rebuild gptzfsboot without GELI support, and =
then
> it will be under 64 KB.

Unfortunately - we rather rely on GELI and PKCS#11.

Dw.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?10FC4055-5650-4C68-A07B-FBA7BF6BB60A>