It is possible to clone your hard drive as a backup before conducting something critical on your machine.
dd if=/dev/... of=/dev/... bs=1m status=progress
gpart recover ...
gpart resize -i 1 ...
On UFS filesystem, don't forget to run growfs if you have replaced the hard drive with a larger one.
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!