Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Sep 2022 00:34:29 -0700
From:      David Christensen <dpchrist@holgerdanske.com>
To:        questions@freebsd.org
Subject:   Re: Corrupted partitions after upgrade from 12.3 to 13.0-RELEASE
Message-ID:  <770bc197-23fc-59f6-280f-993d36a758dc@holgerdanske.com>
In-Reply-To: <f0a7b860-391c-a4c9-b0f1-538c7db20a02@optiplex-networks.com>
References:  <f0a7b860-391c-a4c9-b0f1-538c7db20a02@optiplex-networks.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 8/31/22 18:54, Kaya Saman wrote:
> 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


I suggest:

* Disconnect any other drives while you troubleshoot.

* Take an image of the unhappy disk.

* Make a copy of the image and archive it off-site.


I run 12.3-RELEASE with ZFS boot and encrypted ZFS root.  When I 
upgraded the pools recently, there was a message "don't forget to update 
boot code".  I ended up crawling the FreeBSD installer (a well-written 
shell script) to figure out how the system disk was built; including 
various stages of bootloaders.  Along the way, I saw partition scheming, 
slicing, partitioning, pool creation, filesystem creation, etc..  If you 
have detailed records of your previous disk layout, perhaps you could 
crawl 13.0-RELEASE installer media and verify/ fix the unhappy disk.


Or, you could grab a blank disk, do a fresh install, and recover the 
data from the unhappy disk.


David



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?770bc197-23fc-59f6-280f-993d36a758dc>