Introduction:
This is a guide on how to dual boot windows 11 and FreeBSD 14.
I recently received a fantastic laptop that happens to be surprisingly compatible with FreeBSD,
so I highly recommend it, and no, I am not sponsored by MSI;
I have merely fought enough laptops to recognize a keeper when I see one, and I figured I would spread the news ;D
The laptop I am talking about, is the MSI KATANA GF76 12UG (MS-17L3)
It will serve as our installation target.
Assumptions:
The situation we are in, can be compared to the chicken and the egg problem;
You need a PC to create a live USB stick.
But you also need a live USB stick to install a system on your PC!
I am going to assume you possess a working FreeBSD 14 OS on your PC.
I've never met a human being that knew what FreeBSD was, who did not possess at least three USB sticks,
but in case you don't, make sure to acquire three for the purposes of this tutorial.
They should be at least 4GB, 8GB, and 8GB in size, but 4GB, 16GB, and 8GB is probably recommended, as 8GB will be cutting it close.
Don't Be Like Bob!
Bob is on vacation with his family, including his beautiful, but not so smart wife, who posts everything on social media.
Burglars viewing his wife's profile quickly realize their house is empty and decide to break in...
"Oh no! They stole my laptop!" - Bob screams in terror, as he realizes his belongings are gone, upon returning to the house.
"It had my private diary and rare bird collection on it!" - Bob cries quietly in the corner, mourning the loss of his data,
in fear of what the future will hold...
Don't be like Bob, encrypt your data!
Especially if it's something that should not see the light of day!
The method we are going to employ, won't save you from data loss,
but it is likely to prevent anyone else from using it against you, in case of theft, for example.
General Overview:
Here's the rundown; We are going to install Windows 11 first.
We will then install rEFInd, and finally FreeBSD.
We will configure the UEFI in such a manner, that rEFInd will be booted from by default.
In rEFInd we will provide two menu entries, one being the Windows loader,
and the second, the volume containing the FreeBSD loader and kernel.
We will encrypt a ZFS root partition on the laptop's internal drive;
We will configure the FreeBSD loader in such a way that, in combination with a passphrase
and a key, it will decrypt the zfs partition for us at boot.
Step 0: Acquire The Goodies!
You will need the following:
[TABLE=collapse]
[TR]
[TD]The Windows 11 image[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]The FreeBSD image[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]The rEFInd boot manager[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]The UFS EFI driver[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]The katana drivers[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]The following packages[/TD]
[TD]rsync, 7-zip, fuse, fusefs-ntfs[/TD]
[/TR]
[/TABLE]
For the katana drivers, we only really need the Intel Rapid Storage Technology F6 Driver,
but believe me, if you want the wifi to work on Windows 11, also download the wifi driver ;D
Step 1/2: Identify Your Storage Media:
If you're a newbie, or you just seem to forget these commands for some reason,
these can help you narrow down the device identifier that corresponds to a given disk:
Step 1: Prepare The FreeBSD Bootable Media!
This one is easy; In fact, if you're anything like me, you probably already have and always keep a FreeBSD USB stick on you;
But in case you don't:
FIRST VERIFY THAT THE CHECKSUMS MATCH!!!
I am not kidding! You would not believe how unobvious a corrupted live image can be,
and If you haven't already, you do not want to find out!
So just in case, download the checksum file, and compare the sha256 image checksum with the output of
Once, you've verified everything is in order, proceed to write the image onto the smaller of the two USB sticks.
I shall refer to this USB stick as bsdstick hence forth!
That's it! It's really that simple.
I want you to remember this moment the next time you're about to say something about how complicated FreeBSD is.
Step 2: Prepare The Windows 11 Bootable Media!
A lot of tutorials, say something like, preparing the bootable media is out of the scope of this tutorial...
We are not going to take the easy route, moi cherry!
Fasten your seat belt, it's going to be a bumpy ride...
I've mentioned in the previous section it's important to verify checksums.
Keep this in mind, the Windows 11 image is a couple times larger than the FreeBSD image,
so if you checked the checksum for FreeBSD, then I shouldn't have to convince you to do it in this case.
But I will say it again, anyway, VERIFY THAT THE CHECKSUMS MATCH!!!
One thing worth mentioning, is that the checksums for Windows image files tend to be in all caps.
Do not fear, you can easily convert to lowercase using awk:
Okay, let's do this!
First, we shall wipe the drive and create a master boot record partitioning scheme on it:
Next, we will create the first partition that will hold just enough data to kick start the installer,
so that it can read the big file over 4gs in size from the partition to come:
As mentioned, the install.wim file is over 4Gs so it has to be kept on a second, NTFS partition:
Right, so before we can create a file system on the partition, make sure to load the fusefs module;
You can check if it's loaded using the kldstat command.
If it isn't, you can load it like so:
Once that is taken care of, proceed to create the filesystem:
If it's not in your path, search for it using whereis, or the find utility;
Now, we still need to create one more partition to carry our drivers, etc...
I hope this goes without saying, but just in case, /path/to/winusbsX should be something like /dev/da1sX
Since we are using the MBR partitioning scheme, make sure to use 's' instead of 'p'.
Alright, so we have three partitions with file systems created on them;
Let's mount them:
Can you guess what the next step will be?
I bet if you're a linux user that's done this procedure before, you'd say something like:
"We should mount the ISO image to copy from it"
HAHAHAHA, WRONG! You're in FreeBSD land now, can you hear the wilderness calling?
Seriously, though, you're not technically wrong; In fact you would run mdconfig to configure a virtual device
and then mount the ISO image using that.
But let me tell you a little secret, only a readme file would be waiting for you, saying that your ISO file is not really
an ISO file, but more of an ISO-13346 file.
So what does that mean for us?
As usual, we must resort to trickery!
Behold, the genius solution to our problem:
Use 7-zip, which for some reason is capable of extracting the contents of the Windows ISO file:
Once that is done, we must copy the files in the following manner:
Perfect, but don't forget about the katana drivers, and our EFI associated friends;
Copy them over to ./mnt3
And do yourself a favor by unpacking the disk driver...
Now it is time to unmount the partitions and do a little cleaning:
From this point on, I shall refer to this USB stick as winstick!
This is a guide on how to dual boot windows 11 and FreeBSD 14.
I recently received a fantastic laptop that happens to be surprisingly compatible with FreeBSD,
so I highly recommend it, and no, I am not sponsored by MSI;
I have merely fought enough laptops to recognize a keeper when I see one, and I figured I would spread the news ;D
The laptop I am talking about, is the MSI KATANA GF76 12UG (MS-17L3)
It will serve as our installation target.
Assumptions:
The situation we are in, can be compared to the chicken and the egg problem;
You need a PC to create a live USB stick.
But you also need a live USB stick to install a system on your PC!
I am going to assume you possess a working FreeBSD 14 OS on your PC.
I've never met a human being that knew what FreeBSD was, who did not possess at least three USB sticks,
but in case you don't, make sure to acquire three for the purposes of this tutorial.
They should be at least 4GB, 8GB, and 8GB in size, but 4GB, 16GB, and 8GB is probably recommended, as 8GB will be cutting it close.
Don't Be Like Bob!
Bob is on vacation with his family, including his beautiful, but not so smart wife, who posts everything on social media.
Burglars viewing his wife's profile quickly realize their house is empty and decide to break in...
"Oh no! They stole my laptop!" - Bob screams in terror, as he realizes his belongings are gone, upon returning to the house.
"It had my private diary and rare bird collection on it!" - Bob cries quietly in the corner, mourning the loss of his data,
in fear of what the future will hold...
Don't be like Bob, encrypt your data!
Especially if it's something that should not see the light of day!
The method we are going to employ, won't save you from data loss,
but it is likely to prevent anyone else from using it against you, in case of theft, for example.
General Overview:
Here's the rundown; We are going to install Windows 11 first.
We will then install rEFInd, and finally FreeBSD.
We will configure the UEFI in such a manner, that rEFInd will be booted from by default.
In rEFInd we will provide two menu entries, one being the Windows loader,
and the second, the volume containing the FreeBSD loader and kernel.
We will encrypt a ZFS root partition on the laptop's internal drive;
We will configure the FreeBSD loader in such a way that, in combination with a passphrase
and a key, it will decrypt the zfs partition for us at boot.
Step 0: Acquire The Goodies!
You will need the following:
[TABLE=collapse]
[TR]
[TD]The Windows 11 image[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]The FreeBSD image[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]The rEFInd boot manager[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]The UFS EFI driver[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]The katana drivers[/TD]
[TD]
MSI Global - The Leading Brand in High-end Gaming & Professional Creation
As a world leading gaming brand, MSI is the most trusted name in gaming and eSports. We stand by our principles of breakthroughs in design, and roll out the amazing gaming gear like motherboards, graphics cards, laptops and desktops.
www.msi.com
[/TR]
[TR]
[TD]The following packages[/TD]
[TD]rsync, 7-zip, fuse, fusefs-ntfs[/TD]
[/TR]
[/TABLE]
For the katana drivers, we only really need the Intel Rapid Storage Technology F6 Driver,
but believe me, if you want the wifi to work on Windows 11, also download the wifi driver ;D
Step 1/2: Identify Your Storage Media:
If you're a newbie, or you just seem to forget these commands for some reason,
these can help you narrow down the device identifier that corresponds to a given disk:
Bash:
camcontrol devlist
Bash:
gpart show
This one is easy; In fact, if you're anything like me, you probably already have and always keep a FreeBSD USB stick on you;
But in case you don't:
FIRST VERIFY THAT THE CHECKSUMS MATCH!!!
I am not kidding! You would not believe how unobvious a corrupted live image can be,
and If you haven't already, you do not want to find out!
So just in case, download the checksum file, and compare the sha256 image checksum with the output of
Bash:
sha256sum /path/to/freebsd/image
Once, you've verified everything is in order, proceed to write the image onto the smaller of the two USB sticks.
Bash:
dd if=/path/to/freebsd/image of=/path/to/bsdusb status=progress
I shall refer to this USB stick as bsdstick hence forth!
That's it! It's really that simple.
I want you to remember this moment the next time you're about to say something about how complicated FreeBSD is.
Step 2: Prepare The Windows 11 Bootable Media!
A lot of tutorials, say something like, preparing the bootable media is out of the scope of this tutorial...
We are not going to take the easy route, moi cherry!
Fasten your seat belt, it's going to be a bumpy ride...
I've mentioned in the previous section it's important to verify checksums.
Keep this in mind, the Windows 11 image is a couple times larger than the FreeBSD image,
so if you checked the checksum for FreeBSD, then I shouldn't have to convince you to do it in this case.
But I will say it again, anyway, VERIFY THAT THE CHECKSUMS MATCH!!!
One thing worth mentioning, is that the checksums for Windows image files tend to be in all caps.
Do not fear, you can easily convert to lowercase using awk:
Bash:
echo "$expected_hash" | awk '{print tolower($0)}'
Okay, let's do this!
First, we shall wipe the drive and create a master boot record partitioning scheme on it:
Bash:
gpart destroy -F /path/to/winusb
gpart create -s mbr /path/to/winusb
Next, we will create the first partition that will hold just enough data to kick start the installer,
so that it can read the big file over 4gs in size from the partition to come:
Bash:
gpart add -t fat32 -a 1m -s 1G /path/to/winusb
newfs_msdos /path/to/winusbs1
As mentioned, the install.wim file is over 4Gs so it has to be kept on a second, NTFS partition:
Bash:
gpart add -t ntfs -a 1m -s 7G /path/to/winusb
Right, so before we can create a file system on the partition, make sure to load the fusefs module;
You can check if it's loaded using the kldstat command.
If it isn't, you can load it like so:
Code:
kldload fusefs
Once that is taken care of, proceed to create the filesystem:
Bash:
mkntfs /path/to/winusbs2
If it's not in your path, search for it using whereis, or the find utility;
Now, we still need to create one more partition to carry our drivers, etc...
Bash:
gpart add -t fat32 -a 1m /path/to/winusb
newfs_msdos /path/to/winusbs3
Since we are using the MBR partitioning scheme, make sure to use 's' instead of 'p'.
Alright, so we have three partitions with file systems created on them;
Let's mount them:
Bash:
mkdir mnt1 mnt2 mnt3
mount -t msdosfs /path/to/winusbs1 ./mnt1
ntfs-3g /path/to/winusbs2 ./mnt2
mount -t msdosfs /path/to/winusbs3 ./mnt3
Can you guess what the next step will be?
I bet if you're a linux user that's done this procedure before, you'd say something like:
"We should mount the ISO image to copy from it"
HAHAHAHA, WRONG! You're in FreeBSD land now, can you hear the wilderness calling?
Seriously, though, you're not technically wrong; In fact you would run mdconfig to configure a virtual device
and then mount the ISO image using that.
But let me tell you a little secret, only a readme file would be waiting for you, saying that your ISO file is not really
an ISO file, but more of an ISO-13346 file.
So what does that mean for us?
As usual, we must resort to trickery!
Behold, the genius solution to our problem:
Use 7-zip, which for some reason is capable of extracting the contents of the Windows ISO file:
Bash:
7z x /path/to/win.iso -oiso_dir
Once that is done, we must copy the files in the following manner:
Bash:
rsync -r --progress --exclude sources ./iso_dir/ ./mnt1/
mkdir ./mnt1/sources
cp ./iso_dir/sources/boot.wim ./mnt1/sources/
rsync -r --progress ./iso_dir/ ./mnt2/
Perfect, but don't forget about the katana drivers, and our EFI associated friends;
Copy them over to ./mnt3
And do yourself a favor by unpacking the disk driver...
Now it is time to unmount the partitions and do a little cleaning:
Bash:
umount ./mnt1 ./mnt2 ./mnt3
sync
rmdir ./mnt1 ./mnt2 ./mnt3
rm -R ./iso_dir
From this point on, I shall refer to this USB stick as winstick!