Installation of FreeBSD onto a Logical Partition

Djn: This is what I've been waiting for!

Thanks!

I can't wait to hear if you can successfully add it to GRUB!

Please keep us informed!

+17

Keep up the good stuff ;)

Panarchy
 
Regarding requests to 'HOWTO' this: it is still a work in progress, and the outcome is uncertain. To prevent people from blindly following an incomplete HOWTO (we've all done it!) without reading all the way to the end I propose leaving this here and moving it to the HOWTO section on successful completion. I'll leave it up to Djn to define that moment.
 
Sorry, must've jumped the gun a little... just sooooo EXCITED!

(I'd PM'd him asking to sticky this topic)

Good luck Djn, I'm 'root'ing for ya!

Panarchy
 
Hah, thanks - this is vaguely more worthwhile than my last "I wonder if that'll work", which was FreeBSD on an ext2 root. (For the curious, the answer is that it installed fine, but I never managed to make it mount / read+write. Looked doable, though not advisable.)

I'll get back to it a bit later today.
 
Right, it seems the position of the logical partition I'm creating isn't legal. For now, I'll create it with a gpart live CD instead, and rewrite the original post to reflect it.

edit: It seems geom_part_mbr doesn't seem to do what I expected it to. I have three logical partitions inside the extended partition ad0s1 , and they show up as ad0s1s1, ad0s1s1s1, ad0s1s1s2, ad0s1s2s1, and ad0s1s2s2. At least one of them have the right size and type to be the third one, but it can't be used to read it. *sigh*

It's not a huge problem, since ad0s5, ad0s6 and ad0s7 works - but it means I can't use gpart to get the size and type of the logical partitions, nor to create one.
 
Temporary status update:
Grub 1 has some odd issue where it doesn't want to recognize an logical, UFS-formatted partition no matter the presence/absence of a disklabel (and yes, I've got the right partition type).

Grub 2 can read it fine, but can only load 32-bit FreeBSD kernels.

I'm not sure if I should try to hack in 64-bit support or just settle for a 32-bit FreeBSD isntall - the latter is, of course, way easier.

(edit: I dropped it here for today - we'll see what I do tomorrow. 32-bit FreeBSD as a proof-of-concept seems likely.)
 
Djn: Sweet, thanks.

So from what you've described, GRUB2 can only load 32-bit FreeBSD kernels.

Keep hacking away at that, and I'll see what I can do from the GRUB end.

Thanks,

Panarchy
 
Ah, okay.

Well perhaps we should start reading into other Boot-Loaders?

Perhaps installing the BootLoader of FreeBSD into another OS (Such as Linux, Windows & Solaris) partition.

What are you thoughts?

Any recommendations on standalone boot-loaders?

Thanks in advance,

Panarchy
 
The issue is that at some point, something needs to load and start the FreeBSD kernel.
The only alternatives I'm aware of that can do it are GRUB and the FreeBSD loader - and the latter doesn't seem to like logical partitions. It also only reads UFS2, so you'd have to format a primary partition UFS2 and put the loader+kernel on it, and at that point you might as well just install the rest of FreeBSD there as well.

I'll dig up a FreeBSD/x86 CD image and see if I can make that work, though. That'd still be a significant step forward. ;)
 
So far, so good:
boot.png


The downside is that I have to specify the root device at boot (ufs:ad0s7 , in this case), but if I find out how to pass parameters from GRUB that should be fine: It's just a matter of setting vfs.root.mountfrom .

Oh, and a curious virtualbox/FreeBSD bug: I use a PS/2 keyboard but have a USB one plugged in. Inside vbox, the ps/2 one stops working when the kernel has booted.

edit:
Code:
root (hd0,7)
freebsd /boot/kernel/kernel
freebsd_loadenv /boot/device.hints
set FreeBSD.vfs.root.mountfrom=ufs:ad0s7
boot

That, in grub2, works. Now, to set up a reasonable grub.conf. :)
 
I guess it's time to do another step-by-step guide to getting this done:

Partitions
I used a gparted live CD to create three logical partitions, for /, /usr, and swap. For the lack of a better option I formatted them fat32 - that also makes it possible to check if you've got the right partition later on (it'll mount with mount_msdosfs, be empty, and have the appropriate size and perhaps label).
gparted_done.png


FreeBSD
I then rebooted into a FreeBSD 7.2-BETA1 livefs CD, and in the fixit shell did this:
Code:
[B]Fixit# [/B]newfs /dev/ad0s7
[B]Fixit# [/B]newfs -U /dev/ad0s9
[B]Fixit# [/B]mkdir /new
[B]Fixit# [/B]mount /dev/ad0s7 /new
[B]Fixit# [/B]mkdir /new/usr
[B]Fixit# [/B]mount /dev/ad0s9 /new/usr
[B]Fixit# [/B]exit

In sysinstall, choose Configure.
In the configure menu, first go to Options and change Install Root to /new .
Then go to Distributions, and select base and kernels (picking the GENERIC kernel).
Exiting the Distributions selection will bring up the media selection. Pick whatever works for you, but keep in mind that you can't install off a livefs CD. I used FTP.

When that finishes, exit out to the main menu and start the fixit shell again - it'll complain a bit (about linker cache and mounting /bin, I seem to remember), but that's harmless.
At the shell, do this:
Code:
[B]Fixit# [/B]cd /boot
[B]Fixit# [/B]mv GENERIC kernel
[B]Fixit# [/B]ee /etc/fstab
In the fstab, add something like this:
Code:
/dev/ad0s7    /      ufs   rw     1 1
/dev/ad0s9    /usr   ufs   rw     2 2
/dev/ad0s8    none   swap  sw     0 0

Save, exit, exit the fixit shell, and get ready to mess with grub2 - but first, a small fix.

Partition types
Going back to the gparted live CD, open a shell, start cfdisk, and change the type of the FreeBSD partitions to A5 - the FreeBSD id.
(This could probably have been done straight after the partitioning step. Oh well.)

GRUB 2
To be written - but essentially, "install it and use the commands in the previous post to boot FreeBSD".
 
Thanks

I know that with 32-bit Windows, up to 3.25GB of RAM is supported.

Is it the same, or is it 4GB for 32-bit FreeBSD?

As I only have 4GB of RAM, so maybe if this is the only way... I'll install 32-bit FreeBSD instead.

Thanks,

Panarchy
 
I think a plain 32-bit kernel will have the same problem as windows, though I'm not sure.
You can compile a new kernel with PAE to use all 4 GB, but some drivers have problems with that, and each single process is still limited to seeing a 4GB memory space (minus whatever holes there might be) since they'll keep using 32-bit pointers.
 
Oh...

Darn!

Well is there a way to install the FreeBSD BootLoader into ZFS, Ext3 or NTFS (none of them containing FreeBSD)

As that could save a lot of trouble...
 
Essentially? No. It wants UFS2, and it wants a primary partition.
I'm not sure how the project to make FreeBSD boot from ZFS is going - the official way of having the root file system be on ZFS is still to boot from a UFS file system and then mount / from ZFS later on.
 
Djn said:
Essentially? No. It wants UFS2, and it wants a primary partition.
I'm not sure how the project to make FreeBSD boot from ZFS is going - the official way of having the root file system be on ZFS is still to boot from a UFS file system and then mount / from ZFS later on.

http://wiki.freebsd.org/ZFS

http://wiki.freebsd.org/ZFSOnRoot

Do you know of any 3rd-party boot-loaders that can boot directly to FreeBSD 64-bit?

I have recently been recommended these two; can they do the trick?

http://www2.arnes.si/~fkomar/xosl.org/

http://www.terabyteunlimited.com/bootit-next-generation.htm

Panarchy
 
Looks promising enough.
I'm sort of moving to Oslo the next days, so I might be a bit distracted. I'll see what I can get done, though.
 
Mh, I noticed. :)
I have just moved ... and managed to forget the HD with the vista install and the virtual machines I've been testing on. I'll go fetch it in a few days (along with the power cable to my second monitor, argh), and polish the howto when I've got it.
 
Busy, busy, busy. x)
I'll take a look tomorrow.

edit: Or not - I have apparently promised two different people to meet & drink beer with them tomorrow. Saturday, then.
 
Great, thanks.

Hahahaha, well it's Friday here, and I had some drinks with my work-mates.

XD

Sure, Saturday.
 
Back
Top