Increasing the size of the boot partition of FreeBSD with root on ZFS

In a previous article I migrated my system to root on ZFS, that it also boots from.
When I did that the recommended size was 64K, however with FreeBSD 11 that is too small so to be able to upgrade I need to increase it in size.
I’ve seen some articles say that you need to remove and recreate the pool to do it, but I figured there must be an easier way…

So learning from the previous migration I thought I might as well try doing the same thing I did before, i.e. offline each disk one by one and then recreate the partition table and resilver the disk.

This time I will also relabel the partitions as it was confusing to label them with the same name as the geom(which changes if its connected to another diskport).

Here my pool name is nexus2, and I first verify that I’m working on the right disk.

[root@nexus ~]# zpool status nexus2
pool: nexus2
state: ONLINE
scan: resilvered 109M in 0h0m with 0 errors on Sun Oct 15 16:42:18 2017
config:

NAME STATE READ WRITE CKSUM
nexus2 ONLINE 0 0 0
raidz1-0 ONLINE 0 0 0
gpt/ada0 ONLINE 0 0 0
gpt/ada1 ONLINE 0 0 0
gpt/ada2 ONLINE 0 0 0

[root@nexus ~]# gpart show ada0
=> 34 2930277101 ada0 GPT (1.4T)
34 6 – free – (3.0K)
40 128 1 freebsd-boot (64K)
1064 2930276064 2 freebsd-zfs (1.4T)
2930277128 7 – free – (3.5K)

[root@nexus ~]# gpart show -l ada0
=> 34 2930277101 ada0 GPT (1.4T)
34 6 – free – (3.0K)
40 128 1 (null) (64K)
1064 2930276064 2 ada2 (1.4T)
2930277128 7 – free – (3.5K)

Well would you look at that, ada0 is actually gpt/ada2…
So..

[root@nexus ~]# zpool offline nexus2 gpt/ada2
[root@nexus ~]# gpart destroy -F ada0
ada0 destroyed
[root@nexus ~]# gpart create -s gpt ada0
ada0 created
[root@nexus ~]# gpart add -b 40 -s 512k -t freebsd-boot ada0
ada0p1 added
[root@nexus ~]# gpart add -t freebsd-zfs -l adaX ada0
ada0p2 added
[root@nexus ~]# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
bootcode written to ada0
[root@nexus ~]# zpool replace twotb gpt/ada2 /dev/gpt/adaX

Then let it resilver which will take a few hours depending on how much data there is.
Then just repeat the steps for the rest of the disks and voila:
[root@nexus ~]# zpool status nexus2
pool: nexus2
state: ONLINE
scan: resilvered 109M in 0h0m with 0 errors on Sun Oct 15 16:42:18 2017
config:

NAME STATE READ WRITE CKSUM
nexus2 ONLINE 0 0 0
raidz1-0 ONLINE 0 0 0
gpt/adaX ONLINE 0 0 0
gpt/adaY ONLINE 0 0 0
gpt/adaZ ONLINE 0 0 0

All disks now also have 512k boot part:
[root@nexus ~]# gpart show ada0
=> 34 2930277101 ada0 GPT (1.4T)
34 6 – free – (3.0K)
40 1024 1 freebsd-boot (512K)
1064 2930276064 2 freebsd-zfs (1.4T)
2930277128 7 – free – (3.5K)

[root@nexus ~]# gpart show ada1
=> 34 2930277101 ada1 GPT (1.4T)
34 6 – free – (3.0K)
40 1024 1 freebsd-boot (512K)
1064 2930276064 2 freebsd-zfs (1.4T)
2930277128 7 – free – (3.5K)

[root@nexus ~]# gpart show ada2
=> 34 2930277101 ada2 GPT (1.4T)
34 6 – free – (3.0K)
40 1024 1 freebsd-boot (512K)
1064 2930276064 2 freebsd-zfs (1.4T)
2930277128 7 – free – (3.5K)

This entry was posted in FreeBSD, ZFS and tagged , , , , , . Bookmark the permalink.