From nobody Fri Sep 2 00:47:08 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 4MJfR92Rksz4bFBY for ; Fri, 2 Sep 2022 00:48:21 +0000 (UTC) (envelope-from paulbeard@gmail.com) Received: from mail-vk1-f170.google.com (mail-vk1-f170.google.com [209.85.221.170]) (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 4MJfR8375sz4JDf for ; Fri, 2 Sep 2022 00:48:20 +0000 (UTC) (envelope-from paulbeard@gmail.com) Received: by mail-vk1-f170.google.com with SMTP id t82so317450vkb.6 for ; Thu, 01 Sep 2022 17:48:20 -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=yqi+NDT5qFnUbUZVJRp51QpSViiAPs8e1OF7memrf3g=; b=RUsKicYr8UljevokctphzD36Bm78/LWsnRfno939bASRioR+Z8gF6CAWEC6HBnpYBR E7ZTvZs6dluishAHWtmoA33O90fNWXgsN8YetS8dx48qjAoKO9vJAUfV/oZr4flsoE8z lhY2MaSgKkMkraMAlJP5kwDHqSE9WduJdnfFyXhKYKAgCnXqGEN1x1TGCeI1ILVgGgGa L2filCMsPr1xXPjf1KpdLKOyDv8z/HOzH9udnQBrTse6fU8VTPK71YNZnGqL4FSHpb2T d+/+GFdJhrC6G2MgKDeMz7kVAtjeSZWiHRX5DDw7mNJlV6ncDnAPcyRcx3KQqFGwyq0R cadw== 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=yqi+NDT5qFnUbUZVJRp51QpSViiAPs8e1OF7memrf3g=; b=C8F+aSPJON7yu8CSko3erCYPYQMdP3pLo4nKBu/wCk+nxXaQKypmS7IQy+g1AKfiY2 IYk2+f0F5W/KZ0rfxtzR7qd5L4kO/OPGYTYherIIGbuCHuyh7iP+b+UatWf0Lyh+3OdD fAOo9i7g4GW+mIe7CoIXmj7bi+i4YzdngDDAVeyANSqhK5e8BBWemuysZbSuzuAvjMfB GG7o1ClWU/+q8tHvbPvqZKXobO8V0rVu3LuxHGNhzP3P5tB2UgrW0yw9yeisWEiNmk0F 5dKlQ4DbiG3Rp3e4FxS4JIZ3Dc4mU9wOajSaDSLhyRl1aWBQO4KrEy/mgGV5/Wk4wW2Y iTDg== X-Gm-Message-State: ACgBeo2Huv/OsmpXovgKGyg5PYDGv5lGqF7lvE2yXsVSSxnwr5+PhmZt 2OeKW0P2bi/XMEcB3Uhw6Jkh9GCXUsd1i0wmqiQfRua0 X-Google-Smtp-Source: AA6agR5wyubzkq6e4GpZUbVIt8/v1H5ehp21MS8/02V1NygM0fYZi++3lFoBxVbqJd0YL4Zk3WNqt8NddtV+uPfBLFk= X-Received: by 2002:a1f:a492:0:b0:384:f2ec:c77a with SMTP id n140-20020a1fa492000000b00384f2ecc77amr9428375vke.39.1662079639636; Thu, 01 Sep 2022 17:47:19 -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: <07BE254D-7701-47F2-94E3-09ED7229FB2B@gushi.org> In-Reply-To: From: paul beard Date: Thu, 1 Sep 2022 17:47:08 -0700 Message-ID: Subject: Re: making a disk/slice bootable To: Dan Mahoney Cc: FreeBSD-questions Content-Type: multipart/alternative; boundary="00000000000082510f05e7a712a7" X-Rspamd-Queue-Id: 4MJfR8375sz4JDf X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=RUsKicYr; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of paulbeard@gmail.com designates 209.85.221.170 as permitted sender) smtp.mailfrom=paulbeard@gmail.com X-Spamd-Result: default: False [-3.95 / 15.00]; NEURAL_HAM_SHORT(-0.99)[-0.995]; NEURAL_HAM_LONG(-0.99)[-0.995]; NEURAL_HAM_MEDIUM(-0.96)[-0.957]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; RCVD_IN_DNSWL_NONE(0.00)[209.85.221.170:from]; MLMMJ_DEST(0.00)[freebsd-questions@freebsd.org]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TO_DN_ALL(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.221.170:from]; DKIM_TRACE(0.00)[gmail.com:+]; FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; FREEMAIL_ENVFROM(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_COUNT_TWO(0.00)[2] X-ThisMailContainsUnwantedMimeParts: N --00000000000082510f05e7a712a7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable yeah, I was pretty sure I was using the wrong tool=E2=80=A6thanks for this. So a further Q=E2=80=A6if I continue to use recoverdisk from ports to mirro= r my boot disk to a copy, is it best practice to do this on the mirror after the mirroring is completed? For all I know there is a far better way to do that but this is a FreeBSD 11 system (!) that has just been doing its thing for some years. So it worked (more or less) when it was set up. A backup you can't use isn't much use, as I have learned (again, I expect). On Thu, Sep 1, 2022 at 5:20 PM Dan Mahoney wrote: > > Fdisk is for old-school partitions (where disks had only 1-4 primary partitions, and then subdivided those partitions into "slices" (bsdlabel). > > I'm pretty sure the command you're looking for is: > > gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada1 > > In english, this says: > > * Stick the "protective master boot record" on the root of the disk (/boot/pmbr) > * Write a partition boot label from the file specified... > * to this indexed partition (-i 1) > * ...on ada1 > > From there, you may need to tell the stage 0 loader where to find your next bootable partition on the next boot() prompt. > > -Dan > > > > On Sep 1, 2022, at 16:44, Dan Mahoney wrote: > > > > > > > >> On Sep 1, 2022, at 16:41, paul beard wrote: > >> > >> I have been mirroring the virtual disk in a FreeBSD vm for a couple of years and the main disk got corrupted. The mirrored disk doesn't boot, says it can't find a kernel, so I think I missed out on an additional step, writing an MBR or boot sector, perhaps. > >> > >> The files are all there if I mount them from a VM with FreeBSD.I assume there is a way to make a mountable disk bootable. fdisk and gpart are available but it's been a long time since I messed around with those. > > > > Let's start with the obvious: Can you post your disk layout? Mirrored how? Gmirror/ZFS/Hardware raid/etc? MBR or Gpart? > > > > What commands have you tried thusfar? > > > > What does the boot so far look like (i.e. are you hitting the stage 0 boot loader, and getting the loader prompt?) > > > > More info required, please, but this sounds very fixable. > > > > -Dan > -- Paul Beard / www.paulbeard.org/ --00000000000082510f05e7a712a7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
yeah, I was pretty sure I was using the wrong tool=E2=80= =A6thanks for this.

So a further Q=E2=80=A6if I continue to use rec= overdisk from ports to mirror my boot disk to a copy, is it best practice t= o do this on the mirror after the mirroring is completed? For all I know th= ere is a far better way to do that but this is a FreeBSD 11 system (!) that= has just been doing its thing for some years. So it worked (more or less) = when it was set up. A backup you can't use isn't much use, as I hav= e learned (again, I expect).

On Thu, Sep 1, 2022 at 5:20 PM Dan Mah= oney <freebsd@gushi.org> wro= te:
>
> Fdisk is for old-school partitions (where disks had onl= y 1-4 primary partitions, and then subdivided those partitions into "s= lices" (bsdlabel).
>
> I'm pretty sure the command you= 're looking for is:
>
> gpart bootcode -b /boot/pmbr -p /bo= ot/gptboot -i 1 ada1
>
> In english, this says:
>
>= * Stick the "protective master boot record" on the root of the d= isk (/boot/pmbr)
> * Write a partition boot label from the file speci= fied...
> * to this indexed partition (-i 1)
> * ...on ada1
= >
> From there, you may need to tell the stage 0 loader where to f= ind your next bootable partition on the next boot() prompt.
>
>= -Dan
>
>
> > On Sep 1, 2022, at 16:44, Dan Mahoney &l= t;freebsd@gushi.org> wrote:
= > >
> >
> >
> >> On Sep 1, 2022, at 16:= 41, paul beard <paulbeard@gmail.c= om> wrote:
> >>
> >> I have been mirroring t= he virtual disk in a FreeBSD vm for a couple of years and the main disk got= corrupted. The mirrored disk doesn't boot, says it can't find a ke= rnel, so I think I missed out on an additional step, writing an MBR or boot= sector, perhaps.
> >>
> >> The files are all there= if I mount them from a VM with FreeBSD.I assume there is a way to make a m= ountable disk bootable. =C2=A0fdisk and gpart are available but it's be= en a long time since I messed around with those.
> >
> > = Let's start with the obvious: Can you post your disk layout?=C2=A0 Mirr= ored how?=C2=A0 Gmirror/ZFS/Hardware raid/etc?=C2=A0 MBR or Gpart?
> = >
> > What commands have you tried thusfar?
> >
>= ; > What does the boot so far look like (i.e. are you hitting the stage = 0 boot loader, and getting the loader prompt?)
> >
> > Mo= re info required, please, but this sounds very fixable.
> >
>= ; > -Dan
>


--
Paul Beard / www.paulbeard.org/
--00000000000082510f05e7a712a7--