Dual boot Windows 10 and FreeBSD without boot manager

On a tiny box I got Windows running since years and subsequently updated it from Windows 7 to 10. The partitioning scheme of the internal hard disk is still a MBR one, and I used the Window’s Disk Manager for reducing the size of the Windows partition and by this gaining more than sufficient space for FreeBSD. The installation of FreeBSD then went as usual, and afterwards the disk’s partition layout looked as follows from FreeBSD’s point of view:

# gpart show
=>       63  312581745  ada0  MBR  (149G)
         63  156364767     1  ntfs  (75G)
  156364830       2018        - free -  (1.0M)
  156366848     919552     2  !39  (449M)
  157286400         30        - free -  (15K)
  157286430  155295378     3  freebsd  [active]  (74G)

=>        0  155295378  ada0s3  BSD  (74G)
          0  146800640       1  freebsd-ufs  (70G)
  146800640    8494738       2  freebsd-swap  (4.0G)

For the following discussion the important points are that the Windows-NTFS partition got the device identifier/dev/ada0s1. The FreeBSD base partition is designated by /dev/ada0s3 and its UFS slice is /dev/ada0s3a.

In order to get away without a boot menu for dual booting, which always comes into the way when it is not needed, I wrote the shell script ~/bin/startwin on FreeBSD:

gpart set -a active -i 1 ada0
shutdown -r now

# chmod +x ~/bin/startwin

Of course this shall be executed as root - sudo(8), and it would simply switch the active attribute to the Windows partition, and would reboot the machine immediately, which consequently boots into Windows - of course.

Now, on Windows, I put the following file dp_active_p3.txt into my home directory:

select disk 0
select partition 3

On the desktop I place the command file Start FreeBSD.cmd.

diskpart /s C:\Users\rolf\dp_active_p3.txt
shutdown /r /t 0

I is important to save both files in ANSI text encoding because Windows’s command interpreter may be confused with the initial UTF bytes.  

When I am done with Windows, I simply execute the command file as administrator (right click on it and choose „Admin start“). This would switch the active attribute back to the FreeBSD partition and let the machine reboot immediately, and this of course into FreeBSD now.

On my FreeBSD systems the timezone in the BIOS is set to UTC. Usually, Windows expects the timezone in BIOS set to local time. Windows can be told otherwise by adding a Registry entry to:


Add here a new DWord: RealTimeIsUniversal → 1

Copyright © Dr. Rolf Jansen - 2019-09-03 08:02:02

Discussion on Twitter: 1168851774213689345