Is it possible / sensible to install FreeBSD in a laptop partition

Yeah, try preparing the partition so that the FreeBSD installer finds it and offers it to you on a silver platter.

Seriously? All you need is to let Win (10+ anyway) shrink itself, leaving quite ordinary freespace on the disk.

That's the hard part, it requires you to keep track of how many GB of disk space Windows has, dedicate the rest of the disk to FreeBSD, keep track of the offsets (that are relative to the Windows partition, BTW), and keep converting between bytes, sectors, and GB, because the installer doesn't always give you nice-looking, easy-to-use numbers.

Sounds like you're recalling some nightmares from older Windows versions (understandable), but I was amazed with how well W10's tools for disk management worked - once you dig deep enough in Control Panel (ono) to find them!

Nothing unusual to keep track of. gpart show -p from the install LiveCD then shows clear contiguous space to select, which the installer offers for single or multiple partitions as usual.

Just getting the numbers right IS time consuming and difficult. It forced me to learn to plan things out and write my numbers out BEFORE I even get the installation going. That made a HUGE difference in the success of my dual-boot adventures.

While it's good to have a rough idea how many GB you want in what partitions, there's no need to obsess about fine details, nothing like bsdlabel ...

Next time you're about to wipe a W10+ box to install FreeBSD, hold your nose and try the diskspace tools that balanga detailed early on, before nuking it! <&^}=
 
I do not have a dog in this event, but I do wonder "why" would anybody want to do this?

For starters, Windows is both delicate and problematic, hence the need for a system image for restoration after corruption.
Maybe Windows will make an accurate one and ignore the FBSD partition, or maybe not...
Just curious.
 
Seriously? All you need is to let Win (10+ anyway) shrink itself, leaving quite ordinary freespace on the disk.



Sounds like you're recalling some nightmares from older Windows versions (understandable), but I was amazed with how well W10's tools for disk management worked - once you dig deep enough in Control Panel (ono) to find them!

Nothing unusual to keep track of. gpart show -p from the install LiveCD then shows clear contiguous space to select, which the installer offers for single or multiple partitions as usual.



While it's good to have a rough idea how many GB you want in what partitions, there's no need to obsess about fine details, nothing like bsdlabel ...

Next time you're about to wipe a W10+ box to install FreeBSD, hold your nose and try the diskspace tools that balanga detailed early on, before nuking it! <&^}=
I know about win10's diskmgmt.msc... it was OK stuff, very limited in features. And win11's version left me frustrated, because I could not reliably use it - the utility hangs from time to time, and I suspect that's because I mapped some samba shares to the middle letters of the English alphabet (and those shares are intentionally, by design, not always available, which is OK for my scenario at this time). 😩
 
Yes. I'd made the same assumptions, independently having arrived at the same method: defrag then shrink Win10 to 'sufficient' size, nowadays straightforward; add a common FAT32 or NTFS partition from W10 if desired; install FreeBSD to a newly created slice as usual, reboot or from LiveCD mode on installer, run boot0cfg to set boot options. Done.

In retrospect, I was surprised how easy it was.

Agreed if it's already MBR, but we're all making perhaps sweeping assumptions until Zagzigger returns to let us know.

Not that exploring options meanwhile is a bad thing ...

I will have to look through my laptop disk collection to see if I have Windows installed on a GPT disk and then see if I can install FreeBSD on it.
 
I will have to look through my laptop disk collection to see if I have Windows installed on a GPT disk and then see if I can install FreeBSD on it.
This goes to OP too: you can always create a VM and test it there. Many times you can easily switch between UEFI/legacy so you can test things out. And you can keep snapshots in case you do something wrong.
 
Zagzigger As I mentioned above it might be good idea to test this in VM first, then you can move to the actual HW. Assuming you can UEFI boot and you have Windows installed you can use native Windows tools - format disk partitions - to shrink current disk so you have some spare space for FreeBSD.

Then you can reboot to FreeBSD installer. While I'd go for shell and install FreeBSD there for the purpose of the test I used default installer. I've created partition of given size and run the installer.
This is the state of my disk:
Code:
root@:~ # gpart show
=>       34  419430333  nvd0  GPT  (200G)
         34       2014        - free -  (1.0M)
       2048     921600     1  ms-recovery  (450M)
     923648     202752     2  efi  (99M)
    1126400      32768     3  ms-reserved  (16M)
    1159168  144900063     4  ms-basic-data  (69G)
  146059231  104857601        - free -  (50G)             ; ignore this gap, it was a d:\ drive
  250916832  159383552     6  freebsd-ufs  (76G)
  410300384    8388608     7  freebsd-swap  (4.0G)
  418688992     741375        - free -  (362M)

EFI is used by both Windows and FreeBSD:

Code:
root@:~ # find /boot/efi
/boot/efi
/boot/efi/EFI
/boot/efi/EFI/Microsoft
/boot/efi/EFI/Microsoft/Boot
/boot/efi/EFI/Microsoft/Boot/BCD
/boot/efi/EFI/Microsoft/Boot/BCD.LOG
....
/boot/efi/EFI/Boot
/boot/efi/EFI/Boot/bootx64.efi
/boot/efi/EFI/freebsd
/boot/efi/EFI/freebsd/loader.efi
Right now FreeBSD is the default one. I can use efibootmgr to select next boot:
Code:
root@:~ #  efibootmgr
Boot to FW : false
BootCurrent: 0005
Timeout    : 2 seconds
BootOrder  : 0005, 0004, 0001, 0002, 0003, 0000
+Boot0005* FreeBSD
 Boot0004* Windows Boot Manager
 Boot0001* EFI VMware Virtual SATA CDROM Drive (1.0)
 Boot0002* EFI Network
 Boot0003* EFI Internal Shell (Unsupported option)
 Boot0000* EFI VMware Virtual NVME Namespace (NSID 1)
root@:~ #
I've decided to use Win,FreeBSD only: efibootmgr -o 0000,0005. I rebooted and I'm in Windows. I would have to google around what native tool Windows has to manage EFI entries. I'm assuming you can do it somehow.

Now you can always use EFI shell to select boot. This is fw dependent (asus in your case). As I'm using VMware I can do it this way:

Screenshot 2023-08-24 at 23.19.51.png


And off you go. Without any 3rd party tools..
 
What do you mean by FreeBSD's boot manager?

Are you referring to something other than boot0cfg() ?
I mean that FreeBSD's boot manager works in any configuration you need or want it to work in. That can be MBR, or GPT. It could be BIOS or UEFI, both paired with either partitioning scheme. I'd highly recommend sticking to GPT on new installs unless you have a really good reason not to (MBR is severely limited...), and if you're doing a dual boot setup, Windows is so fragile that you can't easily swap it and keep an install working. For anything in the last decade, UEFI+GPT is almost a sure thing.
 
I mean that FreeBSD's boot manager works in any configuration you need or want it to work in. That can be MBR, or GPT. It could be BIOS or UEFI, both paired with either partitioning scheme. I'd highly recommend sticking to GPT on new installs unless you have a really good reason not to (MBR is severely limited...), and if you're doing a dual boot setup, Windows is so fragile that you can't easily swap it and keep an install working. For anything in the last decade, UEFI+GPT is almost a sure thing.
I'm still not sure what you mean by 'FreeBSD's Boot manager'.... I always associate the term with boot0cfg().

Nowadays, I only ever use GPT for new installs. I do not install Windows, just use it if it is already installed on a disk, where it is invariably on an MBR disk. If I want a multiboot system, I install Ventoy, - a wonderful boot loader!
 
I'm still not sure what you mean by 'FreeBSD's Boot manager'.... I always associate the term with boot0cfg().

Then you have a very narrow-focused view. Review boot(8), notice gptboot(8) and gptzfsboot(8) especially.

I do not install Windows [...] where it is invariably on an MBR disk.

Extremely outdated information. Windows ties partitioning schemes to your firmware type; Windows 10 and older support booting from MBR disks on BIOS machines, and BIOS machines only. Windows Vista and newer support booting from GPT disks on UEFI machines and UEFI machines only. Windows 11 supports booting from GPT disks and UEFI machines exclusively; it does not support MBR or BIOS.

Both Linux and FreeBSD are a lot more flexible, allowing BIOS+MBR, BIOS+GPT, UEFI+MBR, UEFI+GPT equally. You should use GPT unless you have a good reason otherwise.
 
I'm still not sure what you mean by 'FreeBSD's Boot manager'.... I always associate the term with boot0cfg().
Then you have a very narrow-focused view. Review boot(8), notice gptboot(8) and gptzfsboot(8) especially.

No need for any personal disparagement of different understandings.

boot(8) and friends are not 'boot managers', but descriptions of different boot processes and boot blocks.

Boot managers allow boot- time selection of different partitions, OSes or drives to boot, and boot0cfg(8) is FreeBSD's native one for MBR. It has a good manual.

/boot/boot is just 'cat /boot/boot1 /boot/boot2'; installing boot0 just replaces boot1, without changing the slice table. Find boot0.S in /usr/src to see some very tight and clever asm code.

Extremely outdated information

Not everyone is surfing the bow wave ...
 
Afair you can also install FreeBSD to an empty partition using bsdinstall on an UEFI/GPT PC and skip the boot setup.
Then copy loader1.efi to the EFI partition (e.g. as /EFI/freebsd/bootx64.efi ) and then manually add a UEFI bootoption with the PCs UEFI menu selecting this copy.
 
Then you have a very narrow-focused view. Review boot(8), notice gptboot(8) and gptzfsboot(8) especially.
Apologies. I was not aware of boot(8), gptboot(8) and gptzfsboot(8) being boot managers....

Extremely outdated information.
I'm not providing information, merely relating my personal experience. I'm certainly not uptodate on Windows and don't wish to be. I have a lot of old laptop disks which inevitably have some version of Windows installed, but looking through them yesterday I couldn't find any installed on a GPT disk.
 
Afair you can also install FreeBSD to an empty partition using bsdinstall on an UEFI/GPT PC and skip the boot setup.
Then copy loader1.efi to the EFI partition (e.g. as /EFI/freebsd/bootx64.efi ) and then manually add a UEFI bootoption with the PCs UEFI menu selecting this copy.
This sounds interesting although I'm not entirely clear about how you do this. I don't generally use bsdinstall these days but use an existing installation to format and partition a new device creating a freebsd-boot and freebsd-ufs partition, then simply extract the kernel and base txz onto the freebsd-ufs partition and reboot. The new device generally boots up straightaway, stopping at the mountroot prompt, but all you need to do is enter ufs:/dev/da1p2 (adjusted for the relevant device) and it carries on to the login prompt.
 
As FreeBSD was the 2nd installed OS I expect to
a) nothing, i.e. no bootcode in lba0 with mandatory magic and fake partition defined if UEFI boot was selected (and if Windows is UEFI booting)
b) FreeBSD's legacy bootcode in case of legacy boot was selected

While OP didn't specify the model of the Asus why would we fallback to legacy boot at all ? If that book is UEFI capable both Windows and FreeBSD can share uefi partition.

I will say I have one lab machine like this and because one of the partition is Linux I let grub take over the boot. Because, well, it's comfortable. If there's no Linux in equation freezr 's solution is neat.
Or, you can select the boot either from UEFI shell or overwrite it in fw ("bios" menu selection).

It's been some time since I legacy (chain)load Windows off the FreeBSD bootloader but this was a thing before too.


I asked this somewhere on this forums before. I'm really curious -- what issues did you run into? I've never run into any issues with GPT.
i have a hp thin client boxwhich will not boot gpt without efi. it wont even try, just display an error. mbr or gpt + efi works
 
i have a hp thin client boxwhich will not boot gpt without efi. it wont even try, just display an error. mbr or gpt + efi works
By "without efi" you mean that disk using GPT requires EFI partition to be preset otherwise client won't attempt to boot ?

UEFI standard dictates that EFI partition has to be present when using GPT scheme on the disk. That means with GPT scheme there should always be at least one partition - EFI. Even on disk that is not intended for boot (e.g. one big data partition).

Not everybody follows this standard in its firmware. It seems that HP client is.
 
it does not even try to execute the lba0 it just shows no boot options on that disk and refuses to boot from it
 
If you think there is a mandatory reason for using MBR, I'd like to know why.

FreeBSD's boot manager requires MBR


If you have GPT you would probably need to install your own bootloader such as GRUB, which simply adds a number of hurdles into the mix.
In Chapter 15. The FreeBSD Booting Process, at 15.2.1. The Boot Manager, the Handbook says:
The boot manager code in the MBR is sometimes referred to as stage zero of the boot process. By default, FreeBSD uses the boot0 boot manager.
"By default, FreeBSD uses the boot0 boot manager.", has not the most general meaning that it may suggest. It is meant for (only) the MBR partitioning scheme specifically; it is easily interpreted otherwise. The Handbook only explains in detail the boot process for a MBR partitioning scheme in combination with UFS. The chain of steps in the boot process varies depending on the partitioning scheme, the filesystem and (CPU) architecture.

Currently, I see everywhere else in the Handbook that the emphasis is on GTP (instead of MBR), what is to be expected. My guess is that this section has not yet been not updated to cover GPT.

An alternative (third party) bootmanager (GRUB etc.) generally covers a (wide) variety of circumstances of partioning schemes, OS-es etc.; all into one package. With for example FreeBSD's boot0cfg(8), gptboot(8), gptzfsboot(8) and boot(8), you can see seperate parts in the boot process at work. Every one such part describes (and/or manipulates/configures) a part of the FreeBSD boot process; such part maybe used for a one specific situation, such as boot0cfg(8) that can only be used in conjuction with a MBR partitioning scheme. As the name boot0cfg implies, it can act only on boot0; note that boot0 is the actual MBR. With MBR /boot/boot0 is used at STAGE 0 of the boot process; with GPT /boot/pmbr is used instead.

On the one hand you can say that boot0cfg(8) is "a boot manager" with very limited capabilities (although it is not actually used in the boot process: it is an installation/configuration utility for the boot0 boot manager). In that way you could brand other individual parts of FreeBSD as "boot managers" as well. On the other hand, looking at it from a broader view, you can say that all these parts together represent "the FreeBSD boot manager". It depends more or less on your point of view.

For a more complete overview, all in one place, have a look at:
 
Back
Top