I originally installed FreeBSD onto a single ZFS disk and now I want to create a 2-way ZFS mirror from this disk and another new disk and I want to make sure I do it properly.
Here is the current ZFS zroot boot pool:
My thinking is that to do this I need to:
(1) replicate partition layout, types and sizes from the original disk to the new disk
(2) replicate boot code from the original disk to the new disk
(3) attach the new disk to the original disk to form a ZFS mirror
(4) update BIOS boot info to add the new disk to the boot disk list, so that if either half of the boot mirror dies, it will still be able to boot from the other surviving half of the mirror
(a) The original disk is nda4. This is M2_2 on the motherboard, a FreeBSD boot disk (M.2 NVMe SSD)
(b) The new disk is nda1. This is M2_1 on the motherboard, previously occupied by a Linux boot disk (M.2 NVMe SSD).
First I inspected the existing partition table on the original disk (nda4):
Partition #2 is the FreeBSD boot code.
Partition #4 is the ZFS partition.
(1) To replicate the partition layout, types and sizes from original to new disk, is this correct?
(2) To replicate the FreeBSD boot code from the original disk to the new disk, is this correct?
(3) To attach the new disk to the original disk to form a ZFS mirror, is this correct?
At this point, my understanding is that ZFS will resilver nda1p4 with the contents of nda4p4 and I can follow its progress status using
Once resilvering is complete I can move onto step (4) to add nda1 to the boot drive list in the BIOS.
Does all this look correct before I proceed?
I used the following 2 threads to glean the relevant info from:
https://forums.freebsd.org/threads/copying-partitioning-to-new-disk.60937/
https://forums.freebsd.org/threads/how-to-attach-new-device-to-existed-booting-zroot.98797/
Here is the current ZFS zroot boot pool:
Code:
# zpool status zroot
pool: zroot
state: ONLINE
scan: scrub repaired 0B in 00:00:19 with 0 errors on Wed Oct 8 01:45:21 2025
config:
NAME STATE READ WRITE CKSUM
zroot ONLINE 0 0 0
nda4p4 ONLINE 0 0 0
errors: No known data errors
My thinking is that to do this I need to:
(1) replicate partition layout, types and sizes from the original disk to the new disk
(2) replicate boot code from the original disk to the new disk
(3) attach the new disk to the original disk to form a ZFS mirror
(4) update BIOS boot info to add the new disk to the boot disk list, so that if either half of the boot mirror dies, it will still be able to boot from the other surviving half of the mirror
(a) The original disk is nda4. This is M2_2 on the motherboard, a FreeBSD boot disk (M.2 NVMe SSD)
(b) The new disk is nda1. This is M2_1 on the motherboard, previously occupied by a Linux boot disk (M.2 NVMe SSD).
First I inspected the existing partition table on the original disk (nda4):
Code:
# gpart show nda4
=> 40 1953525088 nda4 GPT (932G)
40 532480 1 efi (260M)
532520 1024 2 freebsd-boot (512K)
533544 984 - free - (492K)
534528 4194304 3 freebsd-swap (2.0G)
4728832 1948794880 4 freebsd-zfs (929G)
1953523712 1416 - free - (708K)
Partition #2 is the FreeBSD boot code.
Partition #4 is the ZFS partition.
(1) To replicate the partition layout, types and sizes from original to new disk, is this correct?
Code:
# gpart backup nda4 | gpart restore -F nda1
(2) To replicate the FreeBSD boot code from the original disk to the new disk, is this correct?
Code:
# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 nda1
(3) To attach the new disk to the original disk to form a ZFS mirror, is this correct?
Code:
# zpool attach zroot nda4p4 nda1p4
At this point, my understanding is that ZFS will resilver nda1p4 with the contents of nda4p4 and I can follow its progress status using
zpool status zroot
.Once resilvering is complete I can move onto step (4) to add nda1 to the boot drive list in the BIOS.
Does all this look correct before I proceed?
I used the following 2 threads to glean the relevant info from:
https://forums.freebsd.org/threads/copying-partitioning-to-new-disk.60937/
https://forums.freebsd.org/threads/how-to-attach-new-device-to-existed-booting-zroot.98797/