Installing FreeBSD without overwriting the MBR.

Dendros

Member

Reaction score: 8
Messages: 78

As per title, I would like to know if it's possible to install FreeBSD without overwriting the MBR, the reason is that I want to install FreeBSD on the same hard disk as Windows, since I have some free space on it. I know that FreeBSD can usually detect other OSes but sometimes it does not and I simply don't want to take a risk. I suppose this would mean installing FreeBSD without a bootloader, right? I'm not sure if it is so or not.
If it is so, then I have a second HDD with Debian on it and I plan to use the Grub loader from Debian to boot FreeBSD. It's this possible?
 

balanga

Son of Beastie

Reaction score: 182
Messages: 3,594

To install FreeBSD, you need to create a (UFS) partition, format it and extract two archived files onto that partition. That's all. You should be able to boot from Grub loader. You will need to make sure that /etc/fstab on your UFS partition is able to mount your system while booting though.
 

sand_man

Member

Reaction score: 12
Messages: 62

In addition to what balanga said, the only other requirement is that the partition must be primary. You cannot install FreeBSD to a logical partition.
 
OP
D

Dendros

Member

Reaction score: 8
Messages: 78

Sorry if I'm being obtuse but what are the two archived files that I should copy on disk?
 

Phishfry

Beastie's Twin

Reaction score: 2,320
Messages: 5,238

You should make sure you have a backup of Windows/Linux before you do anything with this.
base.txz and kernel.txz

what are the two archived files that I should copy on disk?
Please notice what he said. Not copy two files but extract them.
extract two archived files onto that partition.
 
Last edited:

ahev

Member


Messages: 28

You should make sure you have a backup of Windows before you do anything with this.
base.txz and kernel.txz


Please notice what he said. Not copy two files but extract them.
I am in a very similar situation as the one who asked the question - I want to install FreeBSD without modifying the MBR/GPT/whatever is located in my first HDD sectors as I have grub installed there which takes care of booting every other system. I just want to install FreeBSD and load it from grub - but I do not understand how to extract these 2 files to the created UFS partition - please explain it in a step-by-step way.

First off,
I do not understand how to create the partition, I now have Linux running and parted available to create partitions and file systems.
 

Phishfry

Beastie's Twin

Reaction score: 2,320
Messages: 5,238

There is no way to explain this in a step by step way. There are too many variables.
Biggest one is legacy BIOS/MBR or EFI install.

Roughly what you need to do is boot off FreeBSD Memstick installer or CD and create your FreeBSD partition UFS filesystem and format it.
Then extract from the memstick the files cited above. They are located on the memstick in /usr/freebsd-dist/
/usr/freebsd-dist/base.txz
/usr/freebsd-dist/kernel.txz
You need to mount your FreeBSD disk partition and extract these files onto your UFS partition.
Tar is included on the FreeBSD memstick.
Then under Linux you will need to make an entry in your grub config pointing to your UFS filesystem with FreeBSD.
 

ahev

Member


Messages: 28

There is no way to explain this in a step by step way. There are too many variables.
Biggest one is legacy BIOS/MBR or EFI install.

Roughly what you need to do is boot off FreeBSD Memstick installer or CD and create your FreeBSD partition UFS filesystem and format it.
Then extract from the memstick the files cited above. They are located on the memstick in /usr/freebsd-dist/
/usr/freebsd-dist/base.txz
/usr/freebsd-dist/kernel.txz
You need to mount your FreeBSD disk partition and extract these files onto your UFS partition.
Tar is included on the FreeBSD memstick.
Then under Linux you will need to make an entry in your grub config pointing to your UFS filesystem with FreeBSD.

Well, the fact that they are on the memstick was not obvious to me, but it makes sense to me now, thanks.

Okay, some details: I think I am using EFI as on Linux I can see that sys/boot/efi is not empty; though I am not sure still...

Now follow-up questions: I have heard that one needs to allocate a partition for FreeBSD swap, so it would be like 2 partitions at least per install, correct? I mean, can I do with having a swap in the form of a file? Or not? So the question is how many partitions should I create?

Next, do I create them while being booted off the memstick with FreeBSD image? Can I do the partitioning beforehand with parted or fdisk?

And for now the final one. It is not clear *where* to put the 2 files. I mean, I should put them to the alerady created file system that stays on one of the partitions that would belong to FreeBSD installation? Please I need more details on this one, this is also related to my first question, so maybe it is better to hear you clear that one out, and then I would ask again :)
 

Phishfry

Beastie's Twin

Reaction score: 2,320
Messages: 5,238

So the question is how many partitions should I create?
Swap is not required. Optional. So one partition is fine.
For UEFI you may need to place FreeBSD bootx64.efi on the FAT32 partition Linux created in its own directory.

Next, do I create them while being booted off the memstick with FreeBSD image? Can I do the partitioning beforehand with parted or fdisk?
Any way is fine. FreeBSD installer medium is guaranteed to have the correct tools to both create the filesystem and format it.

And for now the final one. It is not clear *where* to put the 2 files. I mean, I should put them to the alerady created file system that stays on one of the partitions that would belong to FreeBSD installation?
Repeat-You do not copy them from memstick but extract them using tar.
So after you create your GPT partition and format it UFS for FreeBSD you would mount it.
For example: mount /dev/ada0p2 /mnt (You need to investigate your actual partitions with ls /dev)
Then extract them on to your new partition now mounted on /mnt: tar -xvf /usr/freebsd-dist/base.txz /mnt
These commands are off the top of my head and you may need to adjust them.
 

ahev

Member


Messages: 28

Then extract them on to your new partition now mounted on /mnt: tar -xvf /usr/freebsd-dist/base.txz /mnt
These commands are off the top of my head and you may need to adjust them.
Okay, after that I reboot into Linux and configure grub to see the newly installed FreeBSD?

And another one - is there a way to use bsdinstall, but ask it not to modify my partition tables, or to do it in such a way that it will not destroy the already residing data there that is needed to load other OS?

Do I also need to modify rc.conf or some other configuration files? If I am not going to use the installation script, I think I have to take care of that, right?

Do I understand it right? Basically I will extract kernel.tgz and base.tgz from this page (they will be on usb stick) http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.0-RELEASE/ to the UFS file system created with partitioning tools and I can also install portsto it too by extracting ports.tgz?
 

Phishfry

Beastie's Twin

Reaction score: 2,320
Messages: 5,238

Okay, after that I reboot into Linux and configure grub to see the newly installed FreeBSD?
Yes. I am not sure ifyou need to copy bootx64.efi to the FAT/EFI partition. For MBR that is not needed.

And another one - is there a way to use bsdinstall, but ask it not to modify my partition tables, or to do it in such a way that it will not destroy the already residing data there that is needed to load other OS?
You might be able to drop out of the installer during the 'Disk Partition' phase and drop to shell.

Do I also need to modify rc.conf or some other configuration files? If I am not going to use the installation script, I think I have to take care of that, right?
Yes you must setup rc.conf manually this way. Hostname networking and ssh.

Do I understand it right? Basically I will extract kernel.tgz and base.tgz from this page (they will be on usb stick) http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.0-RELEASE/ to the UFS file system created with partitioning tools and I can also install portsto it too by extracting ports.tgz?
No that version is EOL version. You want 12.1
 

ahev

Member


Messages: 28

Yes. I am not sure ifyou need to copy bootx64.efi to the FAT/EFI partition. For MBR that is not needed.

Yes you must setup rc.conf manually this way. Hostname networking and ssh.

1 - how do I actually check if I need to copy bootx64.efi to the EFI partition? :) I understand that u do not know but should I maybe start a new thread for that?

2 - Is rc.conf all I need to configure or there is something else? I guess I will search the forum and probably ask new question if I do not find how to properly do rc.conf configuration, but maybe there are other configs I need to manually prepare?
 

Phishfry

Beastie's Twin

Reaction score: 2,320
Messages: 5,238

#1) I don't know for sure. I have only done MBR.

#2) In addition to rc.conf setting of hostname you must also generate a /etc/fstab.
Otherwise you get dumped to mount root prompt.
Easy editor is on the freebsd memstick for adding these files. All you absolutely need is hostname in /etc/rc.conf.
hostname="your hostname"

Your /etc/fstab will show the system where to boot from. Use your FreeBSD UFS partition there.
 
Top