Corrupted partitions after upgrade from 12.3 to 13.0-RELEASE

From: Kaya Saman <kayasaman_at_optiplex-networks.com>
Date: Thu, 01 Sep 2022 01:54:14 UTC
Hi,


I was trying to update one of my servers earlier from 12.3-RELEASE to 
13.0 RELEASE and after issuing:


freebsd-update install

shutdown -r now


after following Chapter 24 from the Handbook: 
https://docs.freebsd.org/en/books/handbook/

the Bootloader came up with an error about not being able to access the 
file system on the disk. Having read around a little, information 
pointed to updating the bootcode on the disk.

Following the docs here: 
https://www.freebsd.org/cgi/man.cgi?query=gptboot&sektion=8&format=html

I ran: gpart bootcode -b /boot/pmbr    -p /boot/gptboot -i 1 ada0


Now I get a message saying "Invalid Partitions".


Currently I have a 13.0-RELEASE usb stick in the system which I'm 
booting from and am able to read the information from /dev/ada0 which is 
fine.

If I run: mount /dev/ada0s1 /mnt

The a. slice mounts and the data is there!


However, I think the partition table has become corrupted or altered 
somehow after attempting to update the bootcode as the layout used to be:


/dev/ada0s1a

/dev/ada0s1b


b. slice was for swap.


The FS is UFS of course.... now I only get a single partition and no 
slices at: /dev/ada0s1


In an attempt at recovery I mounted an NFS share on the LiveCD and ran a 
dd backup of the boot drive.

First attempt was: dd if=/dev/ada0s1 of=/path_to_share/freebsd_bak.img

Secondly I tried: dd if=/dev/ada0 of=/path_to_share/freebsd_bak_1.img


In either case when attempting to mount the image I get a message 
saying: "Block device required"


Is it possible to recover the slices or at least read the data from the 
backup image?


I don't mind reinstalling as long as I can access the backup.


gpart show/list ada0 doesn't give any indication about the a. or b. 
slices, so either they are completely gone or I'm not using the correct 
tools.


Would anyone be able to suggest anything to either get the system to 
boot again or at least read the information from the backup image?


Many thanks.


Kaya