From nobody Fri Sep 2 02:10:10 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 4MJhFq6knnz4bRkD for ; Fri, 2 Sep 2022 02:10:23 +0000 (UTC) (envelope-from paulbeard@gmail.com) Received: from mail-vs1-xe2f.google.com (mail-vs1-xe2f.google.com [IPv6:2607:f8b0:4864:20::e2f]) (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 4MJhFp6G7rz3FWm for ; Fri, 2 Sep 2022 02:10:22 +0000 (UTC) (envelope-from paulbeard@gmail.com) Received: by mail-vs1-xe2f.google.com with SMTP id o123so736833vsc.3 for ; Thu, 01 Sep 2022 19:10:22 -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=GyGhuPkbc/NRq4MV3SmXer4MQBTlX/ZU1e+4vTFD5tM=; b=bYaW5Je3c29mikg3fbeTlowUC/JhP/exdoXVyyvrPRiLyrzCKc8HmISBjt5wC3s6MT XuByyFD+u5qq8r43sby9yN2DNgeDcF5DiXv9kEdqf3NCKJGmWn/iST/Xj/f6JXM2cJku JCON9m0PchBjBkzTaG9ralpsxhF8aWjH1cLmAF4nj+p2viP6gIReBvoYYhbopsR/yPaa 8q9zUBEQ7SxLAy3D6O+tyN5dp9IgsOson3QPJMw22csgH0aPdmvx7uqEX1JXpxt/Uf9l SpB4L+04GnHlwvUhRjqWGFUNgODl1btmlQWaGYgZXm6DOiwKHJTE3YUXlb3NQMmUDfNH Wblw== 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=GyGhuPkbc/NRq4MV3SmXer4MQBTlX/ZU1e+4vTFD5tM=; b=4mlQ67r4MuvuJBwyL6nmWf5Lf8K3C+8nrbKgrSmRVHWn2NFz+dU8Q3Ysidn0HBGZC7 2wzYfhHt9MI+ArFiJr4xoVzMq6aPBzPBmsrjMinvwx0/i2sW8IMZO1JrmPg2wC9UAK8o HtBYjWhHo6vJJV3Rn31LZB8skMccU5H7IaKg3v7YSDN4yEZkdQn6CyauTT2ExohXUE+l 5CxgjB2Un8AVAIQSYuL5MWrZxX5Dq19MQOpwb/vT3A8HiQcS4chIunwBHki9PWNSN1Tv 97UECEzsvn4woygXKWqbi19wkjqDF2t3mfS/tm7lptqN/irmqbpe02dZfmGs8IhZfQgC KU0A== X-Gm-Message-State: ACgBeo3yw6doDEZNacreJpBWzUbYRpX+VAkp7rsPjwvd+cVXxHkJ/Q6J dR2lBso7mdzMxBZ9TgI1ERMwfVCT942KOB3eyQLNiXKE X-Google-Smtp-Source: AA6agR6Nzr02UAR1NeFmXH/W+WVc7rHqLRUdZAw3MkOucZDz3JbvjKw7T3NlE0IA0Q7GVNzFPU7iH2e7rBIsWaevbp8= X-Received: by 2002:a67:e3c7:0:b0:388:b85e:4e8b with SMTP id k7-20020a67e3c7000000b00388b85e4e8bmr9833022vsm.43.1662084621506; Thu, 01 Sep 2022 19:10:21 -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> <03F3F917-CCF5-44BB-85F0-00AD3ADF9818@gushi.org> In-Reply-To: <03F3F917-CCF5-44BB-85F0-00AD3ADF9818@gushi.org> From: paul beard Date: Thu, 1 Sep 2022 19:10:10 -0700 Message-ID: Subject: Re: making a disk/slice bootable To: Dan Mahoney Cc: FreeBSD-questions Content-Type: multipart/alternative; boundary="000000000000739d8a05e7a83bc2" X-Rspamd-Queue-Id: 4MJhFp6G7rz3FWm X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=bYaW5Je3; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of paulbeard@gmail.com designates 2607:f8b0:4864:20::e2f as permitted sender) smtp.mailfrom=paulbeard@gmail.com X-Spamd-Result: default: False [-1.00 / 15.00]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; MLMMJ_DEST(0.00)[freebsd-questions@freebsd.org]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::e2f:from]; RCPT_COUNT_TWO(0.00)[2]; DKIM_TRACE(0.00)[gmail.com:+]; FREEMAIL_FROM(0.00)[gmail.com]; FROM_HAS_DN(0.00)[]; RCVD_TLS_LAST(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; TO_DN_ALL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-ThisMailContainsUnwantedMimeParts: N --000000000000739d8a05e7a83bc2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks! That worked just fine but the mirrored/cloned disk has issues. And with no way to get 11.x source, 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. Thanks again for the help=E2=80=A6 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 a= nd > 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. T= he > best advice I can give is "test this BEFORE you need it". Rip your prima= ry > drive out and see if you still boot. > > For a lightweight system, even zfs mirroring is okay, but it does use som= e > ram for caching and the like, so I wouldn't try it with a tiny embedded b= ox. > > -Dan > > On Sep 1, 2022, at 17:47, paul beard wrote: > > yeah, I was pretty sure I was using the wrong tool=E2=80=A6thanks for thi= s. > > So a further Q=E2=80=A6if I continue to use recoverdisk from ports to mir= ror my > boot disk to a copy, is it best practice to do this on the mirror after t= he > mirroring is completed? For all I know there is a far better way to do th= at > but this is a FreeBSD 11 system (!) that has just been doing its thing fo= r > 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 ste= p, > 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? Mirrore= d > 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/ > > > --=20 Paul Beard / www.paulbeard.org/ --000000000000739d8a05e7a83bc2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks! That worked just fine but the mirrored/cloned disk= has issues. And with no way to get 11.x source, I think I have=C2=A0some d= ecisions=C2=A0to=C2=A0make about this system: upgrade and somehow move all = the services across or just quit pretending I understand=C2=A0any of this s= tuff.=C2=A0

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 use= d recoverdisk.=C2=A0 If you're going to mirror, use one of the other th= ings I mentioned. =C2=A0gmirror is low-impact and easy enough to use and su= pported by the various boot loaders.

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

For a li= ghtweight 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 S= ep 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 w= as 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 disk= s had only 1-4 primary partitions, and then subdivided those partitions int= o "slices" (bsdlabel).
>
> I'm pretty sure the co= mmand you're looking for is:
>
> gpart bootcode -b /boot/pm= br -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 f= ile specified...
> * to this indexed partition (-i 1)
> * ...on= ada1
>
> From there, you may need to tell the stage 0 loader w= here to find your next bootable partition on the next boot() prompt.
>= ;
> -Dan
>
>
> > On Sep 1, 2022, at 16:44, Dan M= ahoney <
freebsd@g= ushi.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 v= m 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 wit= h FreeBSD.I assume there is a way to make a mountable disk bootable. =C2=A0= fdisk and gpart are available but it's been a long time since I messed = around with those.
> >
> > Let's start with the obvio= us: Can you post your disk layout?=C2=A0 Mirrored how?=C2=A0 Gmirror/ZFS/Ha= rdware raid/etc?=C2=A0 MBR or Gpart?
> >
> > What command= s have you tried thusfar?
> >
> > What does the boot so f= ar 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/



--
P= aul Beard / www.pau= lbeard.org/
--000000000000739d8a05e7a83bc2--