Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Sep 2022 17:47:08 -0700
From:      paul beard <paulbeard@gmail.com>
To:        Dan Mahoney <freebsd@gushi.org>
Cc:        FreeBSD-questions <freebsd-questions@freebsd.org>
Subject:   Re: making a disk/slice bootable
Message-ID:  <CAMtcK2qd%2BKstLC1oKZm9OPaOYh=gSHxYV=ZjCud2AF5G4n=-Aw@mail.gmail.com>
In-Reply-To: <A99C0412-FD34-46D6-AB9A-AFC45FB10C10@gushi.org>
References:  <CAMtcK2r4L3SCba4EZt73=F2=fnBnEPGvEL3GCM_38R8_e5meXg@mail.gmail.com> <07BE254D-7701-47F2-94E3-09ED7229FB2B@gushi.org> <A99C0412-FD34-46D6-AB9A-AFC45FB10C10@gushi.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--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 <freebsd@gushi.org> 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 <freebsd@gushi.org> wrote:
> >
> >
> >
> >> On Sep 1, 2022, at 16:41, paul beard <paulbeard@gmail.com> 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

<div dir=3D"ltr">yeah, I was pretty sure I was using the wrong tool=E2=80=
=A6thanks for this. <br><br>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&#39;t use isn&#39;t much use, as I hav=
e learned (again, I expect). <br><br>On Thu, Sep 1, 2022 at 5:20 PM Dan Mah=
oney &lt;<a href=3D"mailto:freebsd@gushi.org">freebsd@gushi.org</a>&gt; wro=
te:<br>&gt;<br>&gt; Fdisk is for old-school partitions (where disks had onl=
y 1-4 primary partitions, and then subdivided those partitions into &quot;s=
lices&quot; (bsdlabel).<br>&gt;<br>&gt; I&#39;m pretty sure the command you=
&#39;re looking for is:<br>&gt;<br>&gt; gpart bootcode -b /boot/pmbr -p /bo=
ot/gptboot -i 1 ada1<br>&gt;<br>&gt; In english, this says:<br>&gt;<br>&gt;=
 * Stick the &quot;protective master boot record&quot; on the root of the d=
isk (/boot/pmbr)<br>&gt; * Write a partition boot label from the file speci=
fied...<br>&gt; * to this indexed partition (-i 1)<br>&gt; * ...on ada1<br>=
&gt;<br>&gt; From there, you may need to tell the stage 0 loader where to f=
ind your next bootable partition on the next boot() prompt.<br>&gt;<br>&gt;=
 -Dan<br>&gt;<br>&gt;<br>&gt; &gt; On Sep 1, 2022, at 16:44, Dan Mahoney &l=
t;<a href=3D"mailto:freebsd@gushi.org">freebsd@gushi.org</a>&gt; wrote:<br>=
&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;&gt; On Sep 1, 2022, at 16:=
41, paul beard &lt;<a href=3D"mailto:paulbeard@gmail.com">paulbeard@gmail.c=
om</a>&gt; wrote:<br>&gt; &gt;&gt;<br>&gt; &gt;&gt; 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&#39;t boot, says it can&#39;t find a ke=
rnel, so I think I missed out on an additional step, writing an MBR or boot=
 sector, perhaps.<br>&gt; &gt;&gt;<br>&gt; &gt;&gt; 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&#39;s be=
en a long time since I messed around with those.<br>&gt; &gt;<br>&gt; &gt; =
Let&#39;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?<br>&gt; =
&gt;<br>&gt; &gt; What commands have you tried thusfar?<br>&gt; &gt;<br>&gt=
; &gt; What does the boot so far look like (i.e. are you hitting the stage =
0 boot loader, and getting the loader prompt?)<br>&gt; &gt;<br>&gt; &gt; Mo=
re info required, please, but this sounds very fixable.<br>&gt; &gt;<br>&gt=
; &gt; -Dan<br>&gt;<br><br><br>--<br>Paul Beard / <a href=3D"http://www.pau=
lbeard.org/">www.paulbeard.org/</a></div>

--00000000000082510f05e7a712a7--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMtcK2qd%2BKstLC1oKZm9OPaOYh=gSHxYV=ZjCud2AF5G4n=-Aw>