I wanted to install FreeBSD inside an extended partition (slice in FreeBSD parlance) on a MBR formatted disk. Most of the information on this topic amounts to:
#1: The defaults for GEOM in the kernel (which affect gpart operation) make working with extended partitions difficult
GEOM_PART_EBR (kern.features.geom_part_ebr) is enabled by default as a kernel option, but so is GEOM_PART_EBR_COMPAT (kern.features.geom_part_ebr_compat) which disables the ability to modify partitions in the extended partition using gpart(8), including labeling them. The sysctl variables are read only, so no, you can't just change them after booting. If you even want to attempt doing this on a live install, you'll have to compile your own custom kernel and replace the existing one.
Personally, I didn't bother trying to solve this problem and tried skipping to the next one by making my own partition table with other tools like gparted. This is also difficult, since
#2: bsdinstall will refuse to help you install into an extended partition
Obviously understandable. This is actually the "easiest" problem to overcome by choosing the Shell option, learning how to write a fstab where indicated, and mounting existing partitions.
#3: boot1 doesn't seem to search extended partitions
This where I stopped trying. Boot1 needs to fit in a very very small space (512 bytes), so it needs to be very simple. Finding and traversing extended partitions are too esoteric a feature to be wasting bytes on. I would imagine it would be possible to make a more brittle boot1 that sacrifices other features to achieve extended partition booting, but that's beyond my patience to dive into the assembler knowledge just to discover BTX or loader also have issues.
- This is not supported
- Don't do that
- Why don't you make some other tradeoff?
#1: The defaults for GEOM in the kernel (which affect gpart operation) make working with extended partitions difficult
GEOM_PART_EBR (kern.features.geom_part_ebr) is enabled by default as a kernel option, but so is GEOM_PART_EBR_COMPAT (kern.features.geom_part_ebr_compat) which disables the ability to modify partitions in the extended partition using gpart(8), including labeling them. The sysctl variables are read only, so no, you can't just change them after booting. If you even want to attempt doing this on a live install, you'll have to compile your own custom kernel and replace the existing one.
Personally, I didn't bother trying to solve this problem and tried skipping to the next one by making my own partition table with other tools like gparted. This is also difficult, since
- BSD disklabel support is absent
- It's hard to make small enough partitions for freebsd-boot without careful sector-counting
- The tools won't tag partitions as some FreeBSD partition types and you aren't going to convince gpart(8) to do it
#2: bsdinstall will refuse to help you install into an extended partition
Obviously understandable. This is actually the "easiest" problem to overcome by choosing the Shell option, learning how to write a fstab where indicated, and mounting existing partitions.
#3: boot1 doesn't seem to search extended partitions
This where I stopped trying. Boot1 needs to fit in a very very small space (512 bytes), so it needs to be very simple. Finding and traversing extended partitions are too esoteric a feature to be wasting bytes on. I would imagine it would be possible to make a more brittle boot1 that sacrifices other features to achieve extended partition booting, but that's beyond my patience to dive into the assembler knowledge just to discover BTX or loader also have issues.