BLog

ImprintImpressum
PrivacyDatenschutz
DisclaimerHaftung
Downloads 

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 a FreeBSD one. 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:

#!/bin/sh
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 two files in my home directory:

1. dp_active_p3.txt

select disk 0
select partition 3
active

2. Start FreeBSD.bat

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

Then, when I am finished with Windows, I simply execute the batch 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.

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

PROMOTION