# Installing FreeBSD as a second OS in a DOS partitioned HD



## Vladimir1922 (Sep 21, 2019)

Hey
I recently got a new computer and I found that I couldn't go to legacy (BIOS) boot and had to stick to UEFI.

Long story short: I had to format my old hard drive, installed Linux and after a month I resized it to make room for FreeBSD. However, I am having trouble installing:

When I go to the partition bit it detects the hard drive, the free space, but it prompts me a warning about not being able to install on a DOS partition table and having to reformat to GPT, which will wipe out my Linux partition. I also noticed that automatically using the space wouldn't work (it tries to use all my HD, instead the free space, both marked as unused or even freeBSD). I am trying to use UFS.

Is it possible to go around this without formatting? I have vague memories now that I should have installed BSD first, Linux second, but now is too late.

Thank you


----------



## userxbw (Sep 21, 2019)

YES, EFI needs GPT, BIOS old school is MBR. I will be surprised is you have Linux installed as UEFI on a MBR partition table. Though in theory MBR and EFI boot is possible. Are you sure you have a boot partition where the efi files reside?

, and why is it too last to 'redo' everything?

there is a selection to use the entire drive, or a part of it in the auto install selection. if it is on a primary partition, and that space is raw unformated space Fbsd will see it then use that for its needs. that is how I got mine installed with 1 windows 10 and 2 Linux distros.


----------



## Vladimir1922 (Sep 22, 2019)

Yes, I am quite sure I have the partition for EFI.

My scheme is as follows now:
Partition 1= FAT32, EFI, Boot
Partition 2= Linux Swap
Partition 3=EXT4, boot
Partition 4=Free. 

All in MBR. I redid the install of FreeBSD, and reaching the point of partitioning it clearly says that it needs GPT, I think it only says that while installing to an UEFI system. After that, all it lets me is to redo the partition table to make it GPT, but that will mean everything whiped out, so I cancelled.

I managed to install Project Trident, but I can't make it boot at all on GRUB, so that wasn't very helpful. I might cycle between BSD till I find one works, but I have the feeling this is an UEFI problem, so probably I'll need to do the partition table into GPT anyway


----------



## userxbw (Sep 22, 2019)

all I can say to this is in lue of you not showing why you cannot just redo everything to get everything in line with everything so everything works without arguments.

GPT = UEFI and MBR = legacy boot. don't try to mix and match or you might run into complications as you're already seeing.

in Linux

```
#parted -l
```
to actually see what type of partition table you do have on that drive.
----mod---
just a thought.
you might want to research how to put your kernel and grub onto it, or whatever it is one needs to do in order to get rid or not use the boot partition and go to using a legacy boot for Linux instead.

You say it is MBR already, so making some adjustment to make it boot as a legacy boot might just be possible.

try installing grub to /dev/sda but I'd look and ask around on the Linux forums first to be sure before going all in to it, then me, well I'd still give it a shot.

Because in my head it seems logically possible due to it being an MSDOS partition and not GPT.
go in Linux install (reg) grub /dev/sda update-grub reboot then make the needed changes in BIOS, save exit, then see if it boots into linux.

if not then go from there to fix it. put it back the way it was? chroot install grub-efi 

if you get it to work then remove the boot partition which FBSD must be seeging to its telling you it need GPT or no go. remove that from sight and if all goes well that is all that is needed to get them both working without re-installing Linux again. 

EFI is just another means to point to the kernel to boot the system is all.


----------



## Vladimir1922 (Oct 1, 2019)

Hello: I am not sure if I totally get what you said..

If I do a `parted -l` this is what shows me:

```
#parted -l
Model: ATA WDC WDS200T2B0B- (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system     Flags
 1      1049kB  538MB   537MB   primary  fat32           boot, esp
 2      538MB   1612MB  1074MB  primary  linux-swap(v1)
 3      1612MB  1839GB  1838GB  primary  ext4            boot
 4      1839GB  2000GB  161GB   primary
```
So yeah, you can have a DOS partition table and boot from it. The problem seems that later it doesn't like to look for a second UEFI partiton with that table, even if I keep partitions inside DOS limits. I actually managed to install Project trident without it complaining, but it would simply not recognise a second UEFI partition. I tried Syslinux, grub-uefi, efiboot.... and any of those would recognize anything outside the first UEFI partition for Linux.

I never used UEFI before, so this is all very new. Actually the first thing I did after unboxing my shinny new laptop was to go to the BIOS (or UEFI) settings to activate legacy boot, but simply there is not such option. Neither to deactivate or prioritize which GPU to use, so I am stuck with a really buggy discrete AMD, unless I compile my own kernel without amd drivers on it. Yeey for the super sparse DELL BIOS options lacking important features!.

As I am writting this, I am making a backup of my /home directory. I deducted it'll be just simpler if I format as GPT and do everything as I am supposed to. It is really annoying, but at least I know more about this EFI business. So far I am not liking it a bit tho, but long run it's better for me to learn, as I think that not being able to legacy boot would be the norm.


On a side note, for anyone keeping a partition with Win10 for some reason: My desktop has FreeBSD and I plugged in an old laptop SSD with Win 10 on it, it was dual booting fine, but yesterday a W10 updated prompted telling that it won't update anymore with legacy boot on, so go figure....


Thanks for the help. I'll report if everything is fine after changing the partition table. I know it'll need a bit of work as the ath10k wireless card is not supported yet, so I'll need to find a solution.

Take care!


----------



## Chris236 (Oct 6, 2019)

No idea what the point of this is - but anyway

if you are serious about the multiboot thing, follow the suggestions above and reinstall everything with UEFI and GPT.
else just ditch the FreeBSD partition, install kvm or virtualbox on Linux or Windows and run FreeBSD as  Guest under that.  Much easier.


----------



## userxbw (Oct 30, 2019)

I just got done redoing everything (again)  this time in GPT and UEFI w/CSM due to screen res limiits in FreeBSD 1024x786 .. but yeah it's defiantly doable


----------

