# windows bsd dual boot



## youxiaojie (Oct 10, 2021)

dear friend ,I install bsd to a disk with windows. but the freebsd's default bootloader overwrite my MBR, the windows could not boot.how to coexist bsd and windows? what bootloader should I use? and what to do in install procedure? I don't see any step to ask to install bootloader and set os select menu.
thanx.


----------



## sidetone (Oct 11, 2021)

They use GRUB. People explain it like it's easy, but I don't even understand how to use it. Maybe someday, I'll sit down to focus on understanding it. It acts like something outside the OS, while a directory in it may be a part of it.

Edits less than about an hour later - It's easier to put each operating system on its own drive, so they can be selected from BIOS. Partitions can be copied to another disk. It would still be important to learn how to use GRUB. Storage is also better on a separate drive than from OS drives.

One day, I'll also sit down and learn how to use boot0cfg(8). I've needed to know how to use this ability in the past.


----------



## sko (Oct 11, 2021)

Try using something like rEFInd (https://www.rodsbooks.com/refind/), but prepare for frequent breakage due to windows overwriting the EFI partition on every second chance it gets...
Usually its best to keep windows on a separate disk where it doesn't matter if it borks the boot partitions. just choose the other disk containing rEFInd and BSD (and maybe other OSes) as default in your BIOS/UEFI; rEFInd will find the windows install on the other disk and offer it as a boot option.


----------



## zirias@ (Oct 11, 2021)

Yes. FreeBSD's own bootloader is only designed to boot, well, FreeBSD. Grub, OTOH, can do almost anything (including booting FreeBSD), and yes, it's kind of complex. Using grub is not supported by FreeBSD's installer, so you're on your own setting it up manually. Maybe it might be easier to use some Linux live system to install and configure it.

To anyone who wants a dual-boot system, I ask one thing: did you consider virtualization instead? You could either run Windows in a VM on FreeBSD, or vice versa, depending on which one will be your "main" OS. There are some few usecases where a virtual machine isn't appropriate – but pretty often, it is (and is more flexible).


----------



## SirDice (Oct 11, 2021)

Did you know Windows actually has a boot manager? You can use that to boot FreeBSD. 









						EasyBCD
					

EasyBCD is a software utility for Windows that lets you control and configure the BCD/BOOTMGR bootloader for Windows Vista, Windows 7, Windows 8, and Windows 10 for dual-boots.




					neosmart.net
				



 (it's free to use for personal use)


----------



## mickey (Oct 11, 2021)

sko said:


> Try using something like rEFInd (https://www.rodsbooks.com/refind/), but prepare for frequent breakage due to windows overwriting the EFI partition on every second chance it gets..


+1 on using rEFInd, I've been using it for quite some time now and it works like a charm. Only on one occasion after a windows update, it had messed with the boot loader, so that the machine would boot straight into windows. But it had not overwritten the EFI partition but merely pointed the default boot entry to the windows loader, which was rather easy to fix.



Zirias said:


> To anyone who wants a dual-boot system, I ask one thing: did you consider virtualization instead? You could either run Windows in a VM on FreeBSD, or vice versa, depending on which one will be your "main" OS. There are some few usecases where a virtual machine isn't appropriate


One of which being gaming, which for many (myself included) probably is the sole reason to use windows at all. So no, I haven't given it a second thought.


----------



## Jaskie (Oct 11, 2021)

Are you using legacy BIOS or UEFI  boot?  Are you using ZFS? All these things matter here. Refer to gptzfsboot(8),boot(8), gpart(8) et al. 
If you use legacy BIOS and MBR, I installed FreeBSD with RootOnZFS dual booting Windows. See this: https://gist.github.com/JackieMium/bf8622908bd7e3765b8a7141bb493868



Zirias said:


> To anyone who wants a dual-boot system, I ask one thing: did you consider virtualization instead? You could either run Windows in a VM on FreeBSD, or vice versa, depending on which one will be your "main" OS. There are some few usecases where a virtual machine isn't appropriate – but pretty often, it is (and is more flexible).



For me I've using Windows dual booting Linux for years. Now also dual booting Windows and FreeBSD on a 10+ years old laptop. On such a old machine with very limited resources, VMs are nearly impossible to run smoothly even without additional softwares installed/runnning.


----------



## a6h (Oct 11, 2021)

00. First boot from a Windows USB/DVD, to recover the MBR:
01. Go to the Rescue mode and open a command prompt. Windows installation medium will guide you through that.
02. Then type the following commands:
If for example, "X:" is your windows installation (live DVD/USB) drive letter:

`X:`
`cd boot`
`bootrec /FixMbr`
`bootrec /FixBoot`
`bootrec /RebuildBcd`
`bootsect /nt60 all /force`

03. Reboot the computer. Windows is back.
04. Install EasyBSD as SirDice said.
05. Open the EasyBSD. First 2 MBR partitions belong to Windows.
06. Add a second entry (FreeBSD/BSD type) and assign it to the third MBR partition.
07. reboot and run FreeBSD installer.
08. Choose third MBR partition for BSD Slice and then parition it (/, swap, etc).
09. Reboot the computer, and now you have a two-options BCD menu. (Windows+FreeBSD)
10. Test both of them.
11. Is everthing OK? Yes. Done.

No:

12. If the FreeBSD one doesn't work, boot in the Windows, run the EasyBSD again.
13. Delete the FreeBSD entry (third MBR partition.) and repeat the step #06, reboot and test it again.


----------



## youxiaojie (Oct 11, 2021)

Jaskie said:


> Are you using legacy BIOS or UEFI  boot?  Are you using ZFS? All these things matter here. Refer to gptzfsboot(8),boot(8), gpart(8) et al.
> If you use legacy BIOS and MBR, I installed FreeBSD with RootOnZFS dual booting Windows. See this: https://gist.github.com/JackieMium/bf8622908bd7e3765b8a7141bb493868
> 
> 
> ...


yes, 32bit old machine with mbr and less memory. I see zfs needs more memory.
so I with to get some glue(to tell me use what software is enough) on these situnation,
1.legacy bios or 64bit bios and mbr like core with ddr2 with intel q31 motherboard.
2.64bit efi and gpt thanks.

something confused about freebsd's partition, unlike other system, bsd get a ufs partition, and get slice in ufs, but in other system only can see the who ufs as one partition even gpartition in linux.

now I need legacy bios and mbr.
do bsd's package has this kind software? I see some picture of bsd bootloader show os selector.


----------



## Jaskie (Oct 11, 2021)

youxiaojie said:


> yes, 32bit old machine with mbr and less memory. I see zfs needs more memory.
> so I with to get some glue(to tell me use what software is enough) on these situnation,
> 1.legacy bios or 64bit bios and mbr like core with ddr2 with intel q31 motherboard.
> 2.64bit efi and gpt thanks.
> ...



My laptop is 10+ years old and UEFI is not supported, 4Gig of RAM, and Windows has been there with MBR partition scheme so I just went for legacy BIOS + MBR. They say ZFS needs more memry ana may not be a good choice for small memory, but I've using this setup for days and currently I'd say FreeBSD 13 with Xfce4 as DE performs well.
As for partiotioning, you can leave some space empty on your disk (a partition in Windows not yet formatted as shown in Windows partition management tool). Then boot FreeBSD and create a single slice using all the empty space with gpart(8)(), which is the default behavior when using gpart without `-s` arguement for the size. Then you can create UFS/ZFS and swap partitions in it. If you're not farmiliar with partitioning, just go with auto partiotion layout. For a UEFI + GPT, you may need a `freebsd-boot` partition too. But I am not that farmiliar with UEFI +GPT on FreeBSD myself. Please refer to gptboot(8)() and boot(8)(), the `example` sections provide some really good little examples. And also refer to the links at the end of the gist I posted ealier. I found them really helpful.


----------

