Re: making a disk/slice bootable

From: Dan Mahoney <freebsd_at_gushi.org>
Date: Fri, 02 Sep 2022 02:16:43 UTC

> 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?

http://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/amd64/11.2-RELEASE/ <http://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/amd64/11.2-RELEASE/>

Or use git:

https://freebsdfoundation.org/updating-freebsd-from-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…
> 
> On Thu, Sep 1, 2022 at 5:52 PM Dan Mahoney <freebsd@gushi.org <mailto: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 <mailto:paulbeard@gmail.com>> wrote:
>> 
>> yeah, I was pretty sure I was using the wrong tool…thanks for this. 
>> 
>> So a further Q…if 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 <mailto: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 <mailto:freebsd@gushi.org>> wrote:
>> > >
>> > >
>> > >
>> > >> On Sep 1, 2022, at 16:41, paul beard <paulbeard@gmail.com <mailto: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/ <http://www.paulbeard.org/>
> 
> 
> -- 
> Paul Beard / www.paulbeard.org/ <http://www.paulbeard.org/>