From nobody Thu Sep 1 05:16:17 2022 X-Original-To: freebsd-questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MJ8R34ysZz4bJ9d for ; Thu, 1 Sep 2022 05:16:31 +0000 (UTC) (envelope-from jguojun@gmail.com) Received: from mail-vk1-xa2c.google.com (mail-vk1-xa2c.google.com [IPv6:2607:f8b0:4864:20::a2c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MJ8R1543hz3Hny for ; Thu, 1 Sep 2022 05:16:29 +0000 (UTC) (envelope-from jguojun@gmail.com) Received: by mail-vk1-xa2c.google.com with SMTP id s66so5842454vkb.4 for ; Wed, 31 Aug 2022 22:16:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=oG1VBv0hT3YDOR3B+8UASdMfhYSiO8vgfvlfGH7HTIs=; b=Ny8JzIqCrBgGwuA7y4RjCM8TiYDqKswMyxT+GbgU52fNe7mdLtJnle2/I1CppSRpb/ eHOk4MMXbDL6QRqOkErOAgMGQJFVRmy2IoGYeJYiSfdwoSwgvhqJQXj+hyMpKThxhIrP bgx0y2hxBYs3hKixXwgxxWh4/TrqE799ikV5/UtT6PZu/I3lBOnj1QOcUdidMsyDXIeE WtRR569ooFAfxJ+nFYta6PbPiphtMq1x+aXES0Ju9qIPMnY+6b8qM/Kkx5cLg4PcLk+E 2tWLmCbWsETBaTH5kUJlG1/TegplTeXb0W7cz0ZUZwrr8mSwgMpK3sa5gnGTY6DcBCmj QsVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=oG1VBv0hT3YDOR3B+8UASdMfhYSiO8vgfvlfGH7HTIs=; b=WlNe6ACQkxnYbK6vobe2Offw1Jnl7vhJ/eIbznV24aShEav/EDv+0meRIf4DsLVGIi QtciQsUQZ47XD069Jx/qg1QkiV4pOEZ4/9HWFWtt3G1PXym0vIFxbWzPx8EK+HayqFFe o+gcjTYcu8TKIILGcz3mOBkA77iN7lfhiRgiVVwrwjXBIqgkRcNPMHnsWI/GhCh/ZFY/ w3umqRFzX2Opw5gXOntYEhYY+HmEum8UdyZrGevrqFWS2vta/k+udoGkGmSo8i/I94vm XsjMJG0fMN+SeIlwOJtuDcS47DaTFqV5dOpmJLPriC+Iag/qj48rvzKL66UKvGwXVWV/ CzYQ== X-Gm-Message-State: ACgBeo1t3t6tItHyPzsbC9JjnrOEJr55GyiiPegDYaG4IJtErhwhlVGT oGDSljVVepwT8kLwyekdAeodsOJ3+HtXs3Zf8dUf+2I= X-Google-Smtp-Source: AA6agR4vBW5LBbwxlsM0tXwC0edVHEc41Tsg0/putpSu8Jspc/gaM1lCw80xxkxtC/nE4SU/GB+zv/XeeI8nhlD+Ab4= X-Received: by 2002:a1f:d386:0:b0:393:c20c:4af9 with SMTP id k128-20020a1fd386000000b00393c20c4af9mr6843302vkg.35.1662009388854; Wed, 31 Aug 2022 22:16:28 -0700 (PDT) List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 References: In-Reply-To: From: jin guojun Date: Wed, 31 Aug 2022 22:16:17 -0700 Message-ID: Subject: Re: Corrupted partitions after upgrade from 12.3 to 13.0-RELEASE To: Kaya Saman Cc: freebsd-questions Content-Type: multipart/alternative; boundary="0000000000003c734505e796b79d" X-Rspamd-Queue-Id: 4MJ8R1543hz3Hny X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=Ny8JzIqC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of jguojun@gmail.com designates 2607:f8b0:4864:20::a2c as permitted sender) smtp.mailfrom=jguojun@gmail.com X-Spamd-Result: default: False [-3.95 / 15.00]; NEURAL_HAM_SHORT(-1.00)[-0.995]; NEURAL_HAM_LONG(-1.00)[-0.995]; NEURAL_HAM_MEDIUM(-0.96)[-0.959]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; MID_RHS_MATCH_FROMTLD(0.00)[]; MLMMJ_DEST(0.00)[freebsd-questions@freebsd.org]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::a2c:from]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; TO_DN_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-ThisMailContainsUnwantedMimeParts: N --0000000000003c734505e796b79d Content-Type: text/plain; charset="UTF-8" Recovery of a corrupted partition is usually very hard to do unless you have backed up the first 64 sectors of the disk drive. If you do not have a back of the partition table, then probably try to search for the second boot code location and fix the partition table to see if the disk can be recovered. Make sure to back up the very first 64 sectors before doing it. Corrupting the partition table seems starting at 12.x release. When I installed the 12.x and 13.x or upgraded to a later release, I experienced nearly 30% partition corruption issues, even though I did sync by entering the shell before rebooting. Keep reinstalling in the same configuration, eventually, the installation will be completed. The lesson I learned is to save the first 128-256 sectors of the disk before upgrading. This issue may be related to partition calculation. In release 12 and later, when doing partition as following: a / b sawp d /tmp .etc the partition a + b must be in some satisfaction, typically the partition b, which needs to be 6 GB or 8Gb and greater; otherwise, the size of partition d will be assigned to -1 no matter what value to give. -Jin On Wed, Aug 31, 2022 at 6:59 PM 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 > > > > --0000000000003c734505e796b79d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Recovery of a corrupted partition is usually very har= d to do unless you have backed up the first 64 sectors of the disk drive.
If you do not have a back of the partition table, then probably tr= y to search for the second boot code location and fix the partition table t= o see if the disk can be recovered. Make sure to back up the very first 64 = sectors before doing it.

Corrupting the partition = table seems starting at 12.x release. When I installed the 12.x and 13.x or= upgraded to a later release, I experienced nearly 30% partition corruption= issues, even though I did sync by entering the shell before rebooting. Kee= p reinstalling in the same configuration, eventually, the installation will= be completed.
The lesson I learned is to save the first 128-= 256 sectors of the disk before upgrading.

This iss= ue may be related to partition calculation. In release 12 and later, when d= oing partition as following:
a /
b sawp
d /tm= p .etc

the partition a + b must be in some satisfa= ction, typically the partition b, which needs to be 6 GB or 8Gb and greater= ; otherwise, the size of partition d will be assigned to -1 no matter what = value to give.

-Jin

On Wed, Aug 31, 2022= at 6:59 PM Kaya Saman <kayasaman@optiplex-networks.com> 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.fr= eebsd.org/cgi/man.cgi?query=3Dgptboot&sektion=3D8&format=3Dhtml=

I ran: gpart bootcode -b /boot/pmbr=C2=A0=C2=A0=C2=A0 -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=3D/dev/ada0s1 of=3D/path_to_share/freebsd_bak.img<= br>
Secondly I tried: dd if=3D/dev/ada0 of=3D/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



--0000000000003c734505e796b79d--