[FreeBSD] Root-on-ZFS recovery by using snapshots
Introduction An HDD for a rootFS of my FreeBSD machine has broken. I installed a new HDD and recovered the rootFS from ZFS snapshots. Partitioning The new HDD is recognized as /dev/da1. In this section, da1 is conformed to a broken disk. # gpart destroy -F da1 da1 destroyed # gpart create -s gpt /dev/da1 da1 created # gpart add -s 64K -b 34 -t freebsd-boot -l /boot/boot0 /dev/da1 da1p1 added # gpart add -s 1G -t freebsd-swap -l swap0 /dev/da1 da1p2 added # gpart add -t freebsd-zfs -l disk0 /dev/da1 da1p3 added # gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 /dev/da1 bootcode written to da1 Create zpool for rootFS I named a new zpool rpool2....