# How to install FreeBSD dualboot with other OS



## vodkline (Jan 15, 2016)

Hi ,
iI want install FREEBSDFreeBSD 10 on my laptop
on this laptop , iI have already install Debian.
I want make dual boot, but it doesn't work.
I have installed freesdFreeBSD, but iI can't boot in freebsdFreeBSD.


```
Disque /dev/sda : 465,8 GiB, 500107862016 octets, 976773168 secteurs
Unités : secteur de 1 × 512 = 512 octets
Taille de secteur (logique / physique) : 512 octets / 4096 octets
taille d'E/S (minimale / optimale) : 4096 octets / 4096 octets
Type d'étiquette de disque : gpt
Identifiant de disque : 67275A22-A886-4745-8A44-5C967EC65535

Device  Start  End  Sectors  Size Type
/dev/sda1 2048  206847  204800  100M EFI System
/dev/sda2 206848  468991  262144  128M Microsoft reserved
/dev/sda3 468992 204802047 204333056 97,4G Microsoft basic data
/dev/sda4 204802048 209020927  4218880  2G Linux swap
/dev/sda5 209020928 229986303  20965376  10G Microsoft basic data
/dev/sda6 229986304 250951679  20965376  10G Microsoft basic data
/dev/sda7 250951680 394311679 143360000 68,4G Microsoft basic data
/dev/sda8 394311680 432390143  38078464 18,2G Linux filesystem
/dev/sda9 432390144 438249471  5859328  2,8G Linux filesystem
/dev/sda10 438249472 443125759  4876288  2,3G Linux filesystem
/dev/sda11 443125760 504565759  61440000 29,3G Linux filesystem
/dev/sda12 504565760 504567359  1600  800K EFI System
/dev/sda13 504567360 968036343 463468984  221G FreeBSD UFS
/dev/sda14 968036344 976424951  8388608  4G FreeBSD swap
[/CMD]


[DEL]FREEBSD[/DEL]FreeBSD is installed in [FILE]/dev/sda13[/FILE].

To boot, in GRUB [DEL]i[/DEL]I wrote this code:
[CODE]
menuentry "FreeBSD 10.0" {
insmod ufs2
set root=(hd0,13)
kfreebsd /boot/loader
}
```
?

iI can see "FreeBSD 10.0" in the menu GRUB but when I click, nothing happens.

Can you help me?[/CODE]


----------



## SirDice (Jan 15, 2016)

You can't install FreeBSD on an extended partition, it has to be a primary.


----------



## tobik@ (Jan 15, 2016)

SirDice said:


> You can't install FreeBSD on an extended partition, it has to be a primary.


He's using GPT.

vodkline:
I'm really unsure how GRUB behaves on UEFI systems (which I believe you use for booting?), so this is just a guess. Can you try:

```
menuentry "FreeBSD 10.0" {
	insmod part_gpt
	insmod fat
	insmod chain
        set root=(hd0,gpt12)
	chainloader /efi/boot/BOOTx64.efi
}
```
Also try it with set root=(hd0,gpt1) if that doesn't work.


----------



## SirDice (Jan 15, 2016)

tobik said:


> He's using GPT.


Oh, d'oh. Yes, you're right.


----------



## ANOKNUSA (Jan 15, 2016)

I'm pretty sure you can't have two EFI system partitions on a single disk. You can have multiple EFI binaries on the ESP, but the UEFI specification requires a single ESP at the start of the disk.

EDIT: Seems I'm wrong about that. (Rod Smith is the creator of the rEFInd boot manager, so he'd know a lot better than I do). Maybe GRUB expects the EFI binaries to be on the same partition as itself?


----------



## tingo (Jan 15, 2016)

Anyway, the problems with multiple (U)EFI partitions is easily cured; simply copy the needed files from any EFI partitions to the first one and delete those unneeded EFI partitions.
Remember to put them in a directory. For FreeBSD: \EFI\FreeBSD
You might need a boot manager like rEFInd for  an easy way to select between multiple operating systems. Currently, UEFI firmware (new "bios") varies a lot in capabilities, to put it mildly.
Note: make sure that the EFI partition you are copying to have enough space.


----------



## vodkline (Jan 18, 2016)

iI just test your solution but it doesn't work, when I click, nothing happens, the error message is "The disk is unavailable".


----------



## tingo (Jan 18, 2016)

Details please, details. Describe the steps you took, in detail.
Did you copy files from one EFI partition to another? If so, which partitions and files?
Or did you install rEFInd? If so, does it boot? Which partitions can you see? Can you start an EFI shell? Do you know how to list the partitions that (U)EFI seems in the shell?
I am sorry, but when (U)EFI doesn't work, the process to identify the problem can be long and painful.


----------



## max21 (Jan 25, 2016)

vodkline said:


> Hi ,
> iI want install FREEBSDFreeBSD 10 on my laptop
> on this laptop , iI have already install Debian.
> I want make dual boot, but it doesn't work.
> I have installed freesdFreeBSD, but iI can't boot in freebsdFreeBSD.


iI tried GPT once and dump it. It's in your way.  When it comes to duel-booting use MBR.  Why waste the opportunity to have 3 PRIMARIES when using GPT you only get one.  I have 15 extra slices for FreeBSD and I have 15 extended partitions for XP and FreeBSD.  Each ending in r = 21 each mentally.

I think doing the GPT thing is for having many more extended partitions but you get only one PRIMARY … It’s like the cool thing to do since it was so new and difference everybody wanted to learn it because it gives you 128 partitions…  but you will never have a spare PRIMARY for what may come about in the future.  With MBR I can simply `dd` PRIMARY-3 or any other PRIMARY and give it to Windows-XX or the next generation of OS,  but it will reduce my FreeBSD slices to 10 … so it got to be worth it and above all I have a choice with MBR.  Rule one is to never waste a PRIMARY on Linux.  There is plenty of how-to duel-boot.  My complete setup is here somewhere but I can’t find it.  I hope I am painting you a clear picture.

I want install FREEBSDFreeBSD 10 on my laptop
Put it on ad0s1a or sda1, sda2 and sda3… and give it a decent size.  You can always replace 2 and three with any other OS someday.   You can dd two of them to leave them blank, or mount all blanks slices as I do.   But don’t give it any special boot privilege like a GPT install would force upon you.  That little boot partition is a strange extra something and  MBR will not create it.  I bet that is why you can’t duel-boot.  I BET ALL!  If someone knows better I like to hear about it.

On this laptop , iI have already installed Debian.
Remove it, and install it on ada0s6 = sda6 --- Make sda5 your  swap partition for all Linux you install and boot to.

I want make dual boot, but it doesn't work.
Don’t use GPT – use MBR:

Install grub with your Debian.  If that don’t work it mean Debian is acting too much like FreeBSD and interfering with FreeBSD advance hardware capabilities.  I mean it creates confusion the first time I tried it.  I need nothing throwing off view of FreeBSD.  Better yet, use a pure Linux like Ubuntu or Arch to install your GRUB than put Debian elsewhere in an extended slice.  You must use Linux because you need GRUB to duel boot.  I might not be speaking technically correct, but I do know what it takes to keep from wasting your time with trial and error.

I have installed freesdFreeBSD, but iI can't boot in freebsdFreeBSD.
You said you installed Debian.  Did you install GRUB?  Don't forget.  FreeBSD and Windows needs a PRIMARY … Linux do not!


----------



## wblock@ (Jan 25, 2016)

The only part of FreeBSD that needs a primary MBR partition is boot0, the FreeBSD multi-boot loader.  FreeBSD itself will run from an extended partition.

But I disagree about MBR and GPT.  MBR is weak and difficult to use, and must be combined with BSDlabel partitions.  This makes it even more complicated.  GPT with Grub can be used for multi-booting.  Even easier (and safer) is to just use VMs.


----------



## ANOKNUSA (Jan 25, 2016)

max21, none of your post makes sense. For one thing, the major advantage of GPT is that _there are no "primary" or "extended" partitions_. You can have practically unlimited partitions (there's a limit, but you'd be hard pressed to reach it and still have a useful system), and the only difference between partitions is their size and unique labels. For another, you can upgrade to the "next generation" of Windows from an existing system on MBR, but all clean installs and OEM installs are on GPT disks since Windows 8.


----------



## max21 (Jan 25, 2016)

https://www.petri.com/gpt-vs-mbr-based-disks

This is my point, and some more ideas.  For example, you really should want to dueal-boot on a machine that has a 2-terabyte or _less_ hard drive.  If this is a laptop you want no more than a 500GB hard drive so to back up the entire HDD on key-chain media.  Even a 256GB flash will do.  You don’t fill up a 500GB MBR HDD with movies and games you don’t use.  You do that on a 2-terabye+ GPT hard drive or whatever equivalent.

Just think about the 90’s when a 340 MB HDD maxed out the entire decade.  We did not even see beyond 200GB until 2003 I think.  It did all you need to do using MBR and it still works today.  MBR or GPT hard disk drive has a life of 15 years.  If you format it (I dd it first) before then it will run for another 15 years.  It’s all about what you want to do.  Who care which is better, they both got minor drawbacks.

If this is not true please let me know and I will convert to GPT myself.  Let’s say you have FreeBSD, Windows XP, Windows Vista, and ArchLinux on a GPT formatted disk?  This is IMPOSSIBLE unless you get rid of FreeBSD and replace it with another Windows or Linux.  I don’t mean no disrespect but from my few attempts back when FreeBSD created the new installer which defaulted to a GPT install.  I did not have a clue about GPT just like many others.  I don’t remember all the steps I took but I’m sure it went something like this.  After I installed FreeBSD I installed Windows XP.   Then I tried to install Windows Vista and it did not install.

I fired up Partition Commander from the cd-drive to take a look the hard-drive.  All my Primaries were used up and the GPT thing had destroyed my preformatted extended partitions.  It was the FreeBSD GPT 64K-boot partition that wasted an entire PRIMARY or Partition Table.  After a second try GPT became history.  To me GPT is just another tool just like MBR.  You use what your setup requires.  If you want more Major-Partitions you know now what you have to do.  I hope this makes some since to somebody.  Correct me if I’m wrong, but please not about my terminology, I don’t care what they call it.  The important thing is to get the job done so to get to what one care to be an expert about.  My problem is I go into details about stuff that is usually related but may not be needed.  Sorry, it's a habit.

BTW; as I indicated already, my MBR dueal-boot setup dominate all three PRIMARIES with FreeBSD install(s).  Anything else worth running on my machines must live in VirtualBox on PRIMARY-1.

ARCH rules the MBR for booting  and maintenance of the entire HDD, and he lives on sda5 (swap) and sda6 (ARCH).


----------



## SirDice (Jan 25, 2016)

Windows can only be installed in a GPT partition (or use GPT at all for the boot/system disk) if you boot the installer in UEFI mode.


----------



## wblock@ (Jan 25, 2016)

max21 said:


> Let’s say you have FreeBSD, Windows-XP, Windows-Vista, and Arch-Linux on a GPT formatted disk? This is IMPOSSIBLE unless you get rid of FreeBSD and replace it with another Windows or Linux.


No, this can be done with FreeBSD and Linux.  I don't know if it's possible to boot XP or Vista from a GPT system.  Maybe Grub can do that, but XP at least will have no idea about GPT.

Which brings up another point.  You might be looking at the PMBR used by GPT.  This is not a true MBR, just a simulated one to protect the GPT partitions from old software that only knows MBR.  The standard says it shows just a single simulated MBR partition, but many vendors--including Apple--do some ugly things to try to be compatible or "better".  The Wikipedia article on GPT is pretty good, and will do a better job of explaining this.


----------



## max21 (Jan 25, 2016)

That is what I’m saying too.  Why go through all of that.  GPT cause to much complication for a simple dueal-booting system.  The worse of the problem is GPT cannot boot all common operating systems that we know and use today, and that is a hindrance at setup time.  Just imagine, you had that chance to do it all, but you gave the needed one away.


----------



## wblock@ (Jan 25, 2016)

I don't understand what you are saying, unless it is that we should use MBR because ancient operating systems don't understand GPT.  That is another reason for using VMs, actually.  XP runs well as a VM, and it cleanly separates the system from the hardware and removes many limitations.  Virtualization also allows running multiple systems at the same time and protects each VM's disk from the other VMs.


----------



## max21 (Jan 25, 2016)

I totally missed this part:



wblock@ said:


> FreeBSD itself will run from an extended partition.




Since FreeBSD itself can run in an extended partition that free up one of the special partition-tables, so that s the end of my ideas about MBR, at least until I try this myself.  Actually in my case I need all three FreeBSD installs, so I have no worries about Windows-XP and such because they will live in Virtualbox anyway.  I will definitely try this very soon.  Sorry OP if I threw  you off a bit.  I think even this old dog is due to learn a few new tricks.  But I make no promise to stick to it unless I see something special in it other than so many partitions that can be created that I will never use.

But one thing about ancient operating systems.  You never know when someday you may wish to put one in its own PRIMARY for whatever reason.  It’s not going to be easy for me give up MBR.  Old gives you more hand-on control than what we get these days… You can see that in everything we have out there.  Now I’m getting scared again!


----------



## ANOKNUSA (Jan 26, 2016)

max21 said:


> Since FreeBSD itself can run in an extended partition



Apparently it can. I wouldn't know, because I've never done it. Because _I have six partitions on a GPT disk._ Not "primary" or "logical" partitions. Just partitions.



SirDice said:


> Windows can only be installed in a GPT partition (or use GPT at all for the boot/system disk) if you boot the installer in UEFI mode.



That's likely to be the default on any motherboard manufactured since Windows 8 came out. In the realm of laptops, legacy booting is starting to become something you need to pay extra for.


----------



## protocelt (Jan 26, 2016)

Windows XP and Windows Vista do not and never have supported GPT.

I don't understand why someone would insist on installing different operating systems on the same disk. You are really just asking for problems doing that. As wblock@ mentioned many times in the last few years, and I agree, running different operating systems in a VM(s) works well and is much safer in that they won't clobber one another the first time you attempt to upgrade one of them. Can it be done? Of course. Is it a good idea? Certainly not, at least not unless you enjoy making a hobby out of constantly reinstalling operating systems.


----------



## mickey (Jan 29, 2016)

protocelt said:


> I don't understand why someone would insist on installing different operating systems on the same disk. You are really just asking for problems doing that. As wblock@ mentioned many times in the last few years, and I agree, running different operating systems in a VM(s) works well and is much safer in that they won't clobber one another the first time you attempt to upgrade one of them. Can it be done? Of course. Is it a good idea? Certainly not, at least not unless you enjoy making a hobby out of constantly reinstalling operating systems.


I disagree, I have used dual boot systems with Windows and FreeBSD for way over a decade now and have not had a single occasion, where updating one system has resulted in any problems. This might in part be due to the fact that I just use the Windows boot selector (which comes with every version of Windows since w2k at least) instead of some third-party boot manager solution that might require special code in the disk's rootsector, extra partitions or else. But as I see it, in times of GPT and UEFI, dual booting should even become much cleaner and easier than it used to be back in the days of MBR partitioning.

And I guess there are a number of reasons why people set up dual boot on the same disk. Be it power consumption (more disks use more power), not wanting to run a virtual system in a VM or some other reason. And having seperate disks for each OS still does not give you dual-boot, unless of course you like entering BIOS setup each time to select which disk to boot from.


----------



## protocelt (Jan 29, 2016)

mickey said:


> I disagree, I have used dual boot systems with Windows and FreeBSD for way over a decade now and have not had a single occasion, where updating one system has resulted in any problems. This might in part be due to the fact that I just use the Windows boot selector (which comes with every version of Windows since w2k at least) instead of some third-party boot manager solution that might require special code in the disk's rootsector, extra partitions or else.


Sure, it can work. I have a a single disk system here at home in fact using the same method to dual boot though it did fail to boot once during a FreeBSD upgrade from 9.3-RELEASE to 10.0-RELEASE and I rarely turn it on anymore as it's quite an old system. If you know what your doing it's certainly possible to do and manage and I agree there are sometimes reasons to do so.

The problem IMO,  is a lot of newer FreeBSD users attempting to do this and having problems, then not knowing how to fix them when or if they happen. I just think when starting out, installing FreeBSD in a VM if using only one disk is a better choice until some kind of experience is gained and the user is more comfortable fixing any potential problems that might arise. In a world where a large number of computer users now own a laptop as their only computer, installing FreeBSD in a VM is the safer choice, at least in my opinion.



mickey said:


> But as I see it, in times of GPT and UEFI, dual booting should even become much cleaner and easier than it used to be back in the days of MBR partitioning.


Agreed. I'm hoping that becomes the case at least. Admittedly, I have not tried to boot Windows and FreeBSD on the same disk with UEFI using GPT partitioning yet.


----------



## mickey (Jan 29, 2016)

protocelt said:


> Sure, it can work. I have a a single disk system here at home in fact using the same method to dual boot though it did fail to boot once during a FreeBSD upgrade from 9.3-RELEASE to 10.0-RELEASE and I rarely turn it on anymore as it's quite an old system. If you know what your doing it's certainly possible to do and manage and I agree there are sometimes reasons to do so.
> 
> The problem IMO,  is a lot of newer FreeBSD users attempting to do this and having problems, then not knowing how to fix them when or if they happen. I just think when starting out, installing FreeBSD in a VM if using only one disk is a better choice until some kind of experience is gained and the user is more comfortable fixing any potential problems that might arise. In a world where a large number of computer users now own a laptop as their only computer, installing FreeBSD in a VM is the safer choice, at least in my opinion.


During the phase of evaluating an OS to see how it meets the personal needs and expectations, a VM is surely a better choice than to mess with the physical hardware. Less error prone and the risk to mess something up really badly is marginal. But that's exactly how I see running an OS withing a VM. It's a supplement but not a substitute for running an OS directly on the hardware.



protocelt said:


> Agreed. I'm hoping that becomes the case at least. Admittedly, I have not tried to boot Windows and FreeBSD on the same disk with UEFI using GPT partitioning yet.


Me neither, but I am impatiently awaiting 10.3 release, which will hopefully bring root on ZFS support to FreeBSD's UEFI boot code. As soon as this is out, I will give it a try and see how well it works.


----------

