dual boot win10 and FreeBSD

Manish Jain bourne.identity at hotmail.com
Wed Aug 26 18:02:03 UTC 2020

On 2020-08-26 21:44, doug wrote:
> On Wed, 26 Aug 2020, Aryeh Friedman wrote:
>> I have a working FreeBSD machine (that needs to stay working wo/ any
>> reinstalls) and want to add Windows 10 on a second SSD to the setup.   
>> What
>> is the safest way to set this up for dual boot (starting with installing
>> Windows).
> If your system has IPMI or drac (dell) or some other boot option 
> built-in just use that. I have a supermicro where F11 gets a boot menu 
> that offers any device specified in the BIOS settings. I would not mess 
> with adding to or modifying the FreeBSD boot process unless there is no 
> other choice.

Hi Aryeh,

I have some working experience in this area. So I can tell how you can 
do this with no dependency on BIOS options. It is a bit tricky owing to 
W10 installer being essentially stupid. You must do PRECISELY as 
detailed below.

You will have to first disable UEFI completely and enable CSM 
everywhere.  Your disks must be booted non-UEFI, and must already be 
partitioned MBR or we will have to change the scheme to MBR (no GPT).

Let's assume your first disk has a single FreeBSD slice with a single 
freebsd-ufs partition. This partition must have at least 11 GB free disk 
space (or the disk must have at least 11 GB unused somewhere) - this is 
a pre-condition for getting W10 on the second disk.

1) Backup your FreeBSD partition's data somewhere. You can use rsync for 

2) Attach your second disk as well.

3) Using a Linux installer DVD, repartition the first disk as MBR, with 
four slices and one logical volume:

#fdisk /dev/sda

(Use command o to create a new MBR table)
(Use command n to add a new partition)
(Use command t to change the partition type)
(Use command p to print the partition table)
(Use command w to write out the final partition table)

sda1 : 64 MB                                   : type 7 (ntfs)
sda2 : at least 10 GB                          : type 82 (linux-swap)
sda3 : space needed for FreeBSD                : type a5 (FreeBSD)
sda4 : EBR slice covering remaining disk space : type extended
sda5 : logical volume covering whole EBR slice : type 83 (linux-data)

Although sda2 is linux-swap, FreeBSD can use it as swap readily.

#mkfs.ext2 /dev/sda5

sda5 is your shared partition readable-writeable by both FreeBSD and W10.

5) Use fdisk to create a new MBR table on sdb, and create 2 slices:

#fdisk /dev/sdb

sdb1 : 60 GB (whatever space needed for W10)   : type 7
sdb2 : remaining disk space                    : type 83 (default) or 7

Later when W10 is installed, sdb1 will get split into 2 slices (sdb1 and 
sdb2), while the original sdb2 will get retitled as sdb3.

6) Boot with your W10 DVD.

When you get to the partitioning page, delete sda1 and sda2, and click 
New. This will recreate sda1 and sda2 with approximately the original 
sizes and now both as types ntfs. sda1 is now your W10 system partition.

Click sdb1 and hit Delete. CAREFUL here: With the Unallocated Space 
(originally sdb1) highlighted, click Next/Install. (Do NOT click New). 
This will create sdb1 (W10 root) and sdb2 (W10 recovery) in the 
Unallocated Space.

Install W10.

When done installing W10, boot with your FreeBSD DVD and get into live 

gpart delete -i 2 ada0
gpart add -i 2 -t linux-swap ada0
gpart delete -i 3 ada0
gpart add -i 3 -t FreeBSD ada0
gpart create -s BSD ada0s3
gpart bootcode -b /boot/boot ada0s3
gpart add -t freebsd-ufs ada0s3
newfs -U /dev/ada0s3a

mount /dev/ada0s3a /mnt

Mount your backup at /tmp, and then restore the backup:

rsync -aAHXv /tmp/ /mnt/

Edit /mnt/etc/fstab to change the root partition (ada0s3a)/swap 
partition (ada0s2) device nodes.

And finally, run the commands:

umount /tmp
umount /mnt
boot0cfg -B /dev/ada0

Your dual-boot system is ready.

Manish Jain

More information about the freebsd-questions mailing list