From nobody Fri Sep 2 02:16:43 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 4MJhPK6zdhz4bSK4 for ; Fri, 2 Sep 2022 02:16:53 +0000 (UTC) (envelope-from freebsd@gushi.org) Received: from prime.gushi.org (prime.gushi.org [IPv6:2620:137:6000:10::142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "prime.gushi.org", Issuer "RapidSSL TLS DV RSA Mixed SHA256 2020 CA-1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MJhPJ5N6Sz3HG2 for ; Fri, 2 Sep 2022 02:16:52 +0000 (UTC) (envelope-from freebsd@gushi.org) Received: from smtpclient.apple ([IPv6:2601:602:87f:b05d:a8aa:e32b:2b06:f9e3]) (authenticated bits=0) by prime.gushi.org (8.16.1/8.16.1) with ESMTPSA id 2822GnQc015320 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 1 Sep 2022 19:16:50 -0700 (PDT) (envelope-from freebsd@gushi.org) DKIM-Filter: OpenDKIM Filter v2.10.3 prime.gushi.org 2822GnQc015320 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gushi.org; s=prime2014; t=1662085010; bh=qlIEhrqDS23ycIJEOmil7biASIeqOQ76cMWnykJi5jY=; h=From:Subject:Date:In-Reply-To:Cc:To:References; z=From:=20Dan=20Mahoney=20|Subject:=20Re:=20maki ng=20a=20disk/slice=20bootable|Date:=20Thu,=201=20Sep=202022=2019: 16:43=20-0700|In-Reply-To:=20|Cc:=20FreeBSD-questions=20|To:=20paul=20beard=20|References:=20=0D=0A=20<07BE254D-7701-47F2-94E3-09ED7229F B2B@gushi.org>=0D=0A=20=0D=0A=20=0D=0A=20<03F3F917-CCF5-44BB-85F0-00AD3ADF98 18@gushi.org>=0D=0A=20; b=XoswZikDasx6rTJvajCieCyPcIue4uBUnk2w13kTH1+leNc6KcWKl/o9sf8m+Djg3 Vxh3ldvAGIbV5CPRliLD/hYeINBUuoS4naMe0BEJS+JeTWvPFVsYUjKGSbkFZeiQ4V 8ATlav6rQtC2k0DRx5XBcNE73wVXz7PdhlX8Sczdf/OI9MNnCoEZTPA1RSSjqQWn2E gEZAkt2jQjoNfSEUGgHtI4QWFqg9RI2vDdQ8HSSfhH0bhMR232OUvzK5qyJY3ncbhB mJ+VkgJ6J4EXTc3OXBOAqsmruyA44YcxH6SYYCt7vxPzlZ2DLrOYOvWr7pul2RfyXw d0tPgu+Vsh+Ow== X-Authentication-Warning: prime.gushi.org: Host [IPv6:2601:602:87f:b05d:a8aa:e32b:2b06:f9e3] claimed to be smtpclient.apple From: Dan Mahoney Message-Id: <47C13690-BE4D-42E5-830F-33309F553676@gushi.org> Content-Type: multipart/alternative; boundary="Apple-Mail=_1FEFD667-DD7D-4CD7-A209-A82657ED7E0A" 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 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: making a disk/slice bootable Date: Thu, 1 Sep 2022 19:16:43 -0700 In-Reply-To: Cc: FreeBSD-questions To: paul beard References: <07BE254D-7701-47F2-94E3-09ED7229FB2B@gushi.org> <03F3F917-CCF5-44BB-85F0-00AD3ADF9818@gushi.org> X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Rspamd-Queue-Id: 4MJhPJ5N6Sz3HG2 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gushi.org header.s=prime2014 header.b=XoswZikD; dmarc=pass (policy=none) header.from=gushi.org; spf=pass (mx1.freebsd.org: domain of freebsd@gushi.org designates 2620:137:6000:10::142 as permitted sender) smtp.mailfrom=freebsd@gushi.org X-Spamd-Result: default: False [-3.20 / 15.00]; DWL_DNSWL_MED(-2.00)[gushi.org:dkim]; MV_CASE(0.50)[]; DMARC_POLICY_ALLOW(-0.50)[gushi.org,none]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; RCVD_IN_DNSWL_MED(-0.20)[2620:137:6000:10::142:from]; R_SPF_ALLOW(-0.20)[+mx]; R_DKIM_ALLOW(-0.20)[gushi.org:s=prime2014]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; DKIM_TRACE(0.00)[gushi.org:+]; MIME_TRACE(0.00)[0:+,1:+,2:~]; MLMMJ_DEST(0.00)[freebsd-questions@freebsd.org]; ASN(0.00)[asn:393507, ipnet:2620:137:6000::/44, country:US]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; HAS_XAW(0.00)[]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N --Apple-Mail=_1FEFD667-DD7D-4CD7-A209-A82657ED7E0A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Sep 1, 2022, at 19:10, paul beard wrote: >=20 > Thanks! That worked just fine but the mirrored/cloned disk has issues. Which you didn't describe at all. > And with no way to get 11.x source,=20 Uh, what? = http://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/amd64/11.2= -RELEASE/ = Or use git: https://freebsdfoundation.org/updating-freebsd-from-git/ = Or just try freebsd-update ids > I think I have some decisions to make about this system: upgrade and = somehow move all the services across or just quit pretending I = understand any of this stuff.=20 Without knowing how your system is damaged I can't help this, but if = you've been doing things in a mostly freebsd-stable way, most of what = you need should be in /etc, /usr/local/etc, and /var. -Dan >=20 > Thanks again for the help=E2=80=A6 >=20 > On Thu, Sep 1, 2022 at 5:52 PM Dan Mahoney > wrote: > I haven't used recoverdisk. If you're going to mirror, use one of the = other things I mentioned. gmirror is low-impact and easy enough to use = and supported by the various boot loaders. >=20 > If you're just cloning disk to similar disk with rsync, you should not = need to do this more than once, unless maybe if you upgrade your system. = Normal freebsd-update upgrades do not generally touch the boot blocks. = The best advice I can give is "test this BEFORE you need it". Rip your = primary drive out and see if you still boot. >=20 > For a lightweight system, even zfs mirroring is okay, but it does use = some ram for caching and the like, so I wouldn't try it with a tiny = embedded box. >=20 > -Dan >=20 >> On Sep 1, 2022, at 17:47, paul beard > wrote: >>=20 >> yeah, I was pretty sure I was using the wrong tool=E2=80=A6thanks for = this.=20 >>=20 >> So a further Q=E2=80=A6if I continue to use recoverdisk from ports to = mirror 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).=20 >>=20 >> 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 >> > >> > =46rom 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 >> > >>=20 >>=20 >> -- >> Paul Beard / www.paulbeard.org/ >=20 >=20 > --=20 > Paul Beard / www.paulbeard.org/ --Apple-Mail=_1FEFD667-DD7D-4CD7-A209-A82657ED7E0A Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Sep 1, 2022, at 19:10, paul beard <paulbeard@gmail.com>= wrote:

Thanks! That worked just fine but the = mirrored/cloned disk has issues.

Which you didn't describe at all.

And with no way to get 11.x source, 

Uh, = what?


Or use = git:

https://freebsdfoundation.org/updating-freebsd-from-git/

Or just try freebsd-update = ids

I think I have some = decisions to make about this system: upgrade and somehow move = all the services across or just quit pretending I understand any of = this stuff. 

Without = knowing how your system is damaged I can't help this, but if you've been = doing things in a mostly freebsd-stable way, most of what you need = should be in /etc, /usr/local/etc, and /var.

-Dan



Thanks again for the help=E2=80=A6

On Thu, Sep 1, 2022 at 5:52 PM Dan Mahoney <freebsd@gushi.org> = wrote:
I = haven't used recoverdisk.  If you're going to mirror, use one of = the other things I mentioned.  gmirror is low-impact and easy = enough to use and supported by the various boot loaders.

If you're just cloning = disk to similar disk with rsync, you should not need to do this more = than once, unless maybe if you upgrade your system.  Normal = freebsd-update upgrades do not generally touch the boot blocks.  = The best advice I can give is "test this BEFORE you need it".  Rip = your primary drive out and see if you still boot.

For a lightweight = system, even zfs mirroring is okay, but it does use some ram for caching = and the like, so I wouldn't try it with a tiny embedded box.

-Dan

On Sep 1, 2022, at 17:47, paul = beard <paulbeard@gmail.com> wrote:

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 mirror 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
>
> =46rom 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/



--
Paul Beard / www.paulbeard.org/

= --Apple-Mail=_1FEFD667-DD7D-4CD7-A209-A82657ED7E0A--