Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Jan 2020 17:57:34 +0100
From:      Polytropon <freebsd@edvax.de>
To:        Manish Jain <bourne.identity@hotmail.com>
Cc:        Thomas Mueller <mueller6722@twc.com>, "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org>
Subject:   Re: Need help trying to recompile kernel with EBR functionality
Message-ID:  <20200101175734.2e5c66ba.freebsd@edvax.de>
In-Reply-To: <DB8PR06MB644289575A457EA98D83E2EBF6210@DB8PR06MB6442.eurprd06.prod.outlook.com>
References:  <DB8PR06MB6442B425832B28E6E16AC181F6210@DB8PR06MB6442.eurprd06.prod.outlook.com> <202001011526.001FQUeA001903@r56.edvax.de> <20200101163902.60776151.freebsd@edvax.de> <DB8PR06MB644289575A457EA98D83E2EBF6210@DB8PR06MB6442.eurprd06.prod.outlook.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 1 Jan 2020 15:50:05 +0000, Manish Jain wrote:
> 
> On 2020-01-01 21:09, Polytropon wrote:
> > On Wed, 01 Jan 2020 06:19:33 +0000, Thomas Mueller wrote:
> >>> I am a long time user of FreeBSD but have never recompiled my kernel.
> >>
> >>> I am trying to compile a custom 12.1 amd64 kernel with the ability
> >>> to add/delete EBR partitions, but the online documentation did not
> >>> help and I ended up losing EBR functionality entirely.
> >>
> >>> The steps I followed were as under :
> >>
> >>> 1) copied [/usr/src/sys/amd64/conf/]GENERIC as EBRKERNEL
> >>> 2) commented out GEOM_PART_EBR_COMPAT in [/usr/src/sys/amd64/conf/]DEFAULTS
> > A little sidenote: Do not change that file. All your kernel
> > configurations should be in the kernel configuration file.
> > In order to deviate from the defaults, use "nooption <name>"
> > to disable an existing option, and (as shown correctly)
> > "option <name>" to add an additional one; same for "device"
> > and "nodevice".
> >
> >
> >
> >>> 3) inserted 'options GEOM_PART_EBR' into my kernel configuration
> >>> file EBRKERNEL
> >>> 4) cd /usr/src
> >>> 5) make buildkernel KERNCONF=EBRKERNEL
> >>> 6) make installkernel KERNCONF=EBRKERNEL
> >>
> >>> When I shutdown the system and rebooted into the new kernel, the
> >>> boot process halted complaining that it could find any device
> >>> /dev/ada0s5 (the EBR partition).
> >>
> >>> What am I doing wrong ? Any help in getting me a good custom kernel
> >>> with the ability to add/delete EBR partitions would be greatly appreciated.
> >>> Thank you & Regards,
> >>> Manish Jain
> >> I am rather confused here.  My first inclination would be to suggest
> >> you switch to GPT.
> > This often is not an option for multi-OS settings because it
> > lacks boot selection (through FreeBSD's boot manager), and
> > the support across different operating systems (for example,
> > read partition of of OS 1 from OS 2) sometimes causes trouble
> > when GPT is involved.
> >
> >
> >
> >> Using MBR, you get up to 4 partitions, of which one may be
> >> an extended boot record.  That partition is a container for
> >> logical-partition data, not a partition that can be mounted
> >> or copied to or from.
> > The "DOS extended partition" (which contains "logical volumes")
> > is not to be addressed directly; instead the "logical volumes"
> > inside it are. And that's completely okay for non-bootable
> > partitions (such as data partitions). So basically there are
> > 3 "DOS primary partitions" (bootable - 3 systems), one "slot"
> > for the "DOS extended partition", and inside it, any further
> > partitions needed, for example shared /home partitions for
> > Linux.
> >
> > FreeBSD itself does not need any of this. ;-)
> >
> >
> >
> >> It seems to me the EBR partition would be s1, s2, s3, or s4
> >> but no higher.  I'd need to see your full partition table
> >> data, such as you get with "fdisk -lu" in Linux, or you can
> >> use gpart with "show" in FreeBSD.
> > If I remember the numbering system correctly, s1 - s4 are
> > reserved for "DOS primary partitions" - slices. The "logical
> > volumes" as well as the "DOS extended partition" containing
> > them have a higher "s value".
> >
> >
> >
> >> Maybe you have the wrong partition name (ada0s5)?  You can
> >> go to the loader prompt and get a rough idea of what's in
> >> the partitions, and change the root partition to boot into.
> > So if ada0s5 is the "DOS extended partition", it's absolutely
> > understandable that no partition (read: slice) can be found.
> > I think the problem here is that the number is wrong. It's
> > worth verifying the correct numbers with gpart. The "logical
> > volumes" that need to be addressed (as a "slice equivalent")
> > then probably should be ada0s6 and so on.
> >
> >
> >
> >> I have created logical partitions with Linux fdisk but never
> >> any BSD fdisk.  I believe there is a linuxfdisk in FreeBSD
> >> ports, category would be sysutils to the best of my memory.
> > In the past, I used FreeBSD's ye olde fdisk for partition
> > creation, it worked, but the common suggestion was to use
> > the OS that would be _using_ the partition for initializing
> > it, and adding the required file systems. WIth goart, however,
> > this should basically work.
> >
> >
> >
> 
> Thomas's idea worked. sysutils/linuxfdisk is able to create/delete 
> logical volumes
> 
> under FreeBSD, when FreeBSD gpart itself cannot.

That's why tools like GPartEd (for example on the UBCD) are
a much better solution that what FreeBSD includes natively.
It would be nice to have that Linux-specific functionality
implemented in FreeBSD's stock gpart, so all steps of disk
initialization can be done with FreeBSD (and scripted).



> And I completely agree with Polytropon that boot0 is much better for 
> multi-OS systems, but boot0 works only on MBR - which is why I never use 
> GPT.

Definitely. It's simple and predictable, doesn't require any
maintenance (like GRUB), and works with everything that is
MBR-based.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200101175734.2e5c66ba.freebsd>