Installation of FreeBSD onto a Logical Partition

Hello

I currently have Mac OS X, Windows Vista 64-bit, Windows 7 64-bit, Windows Server 2008 64-bit, Fedora 10 64-bit & Ubuntu 8.10 64-bit installed on within my MBR on my hard-drive.

(Primaries: Mac OS X & Windows 7 64-bit)

I plan on adding Solaris and OpenSolaris (OpenSolaris on logical, was told this is possible from Sun.com LiveChat) as well.

As well as these 8 aforementioned Operating Systems, I wish to install FreeBSD.

After all these operating systems have been installed, I'd still have over 100GB spare for FreeBSD.

Please tell me if there is any way possible to install FreeBSD onto a logical (UFS or ZFS) partition.

Thanks in advance,

Panarchy
 
It's no limitation. The BSD, OSX and I think Solaris work like that.

So you have a few options: get another disk, remove one of your OS that take up a primary partition or use FreeBSD in a virtual machine.
 
tangram said:
It's no limitation. The BSD, OSX and I think Solaris work like that.

So you have a few options: get another disk, remove one of your OS that take up a primary partition or use FreeBSD in a virtual machine.

It is a limitation.

OpenSolaris doesn't have that limitation, and either does Solaris (as long as one or the other has a primary for the boot-partition)

Please remove the aforementioned limitation.
 
Wait, did you just say Solaris/Opensolaris requires a primary boot partition but can have the rest of the file system in a logical partition? That's ... no better than FreeBSD.
 
Djn said:
Wait, did you just say Solaris/Opensolaris requires a primary boot partition but can have the rest of the file system in a logical partition? That's ... no better than FreeBSD.

Ah, okay. Now we're getting somewhere.

Since FreeBSD can use ZFS as it's root partition, and since Solaris's and OpenSolaris's GRUB menu both have the added capability to boot ZFS, would that mean that I can install FreeBSD onto a logical partition, and use the ZFS4GRUB as /Boot?

Or if I were to install FreeBSD onto a primary partition, then install FreeBSD again onto a logical partition, then remove the FreeBSD from the Primary partition, and install Solaris or OpenSolaris there instead, subsequently adding FreeBSD to that GRUB menu...

Would either of the aforementioned methods work?

Panarchy
 
Hmm - I was pondering similar things when I wrote that.
I think it might be possible to prod Grub into starting the FreeBSD loader from a logical partition, and if vfs.root.mountfrom is then set to the right device that might actually be all it takes. I'll have to play with it a bit.

The issue with booting the loader from a ZFS partition is that it will want to grab a kernel and possibly some modules, in addition to its config files. I wouldn't bet on it having ZFS support. Of course, you could make grub load the kernel directly, but that has its own issues, mainly that I'm not sure if grub will let you preload modules or send config strings to the FreeBSD kernel.

As for the actual install, well - you'll have to bodge it onto there somehow. I'd suggest a FreeBSD live CD, that will give you a few options.
The "cleanest" is probably to compile up a world+kernel somewhere (another computer, possibly inside a virtual machine), mounting /usr/src and /usr/obj from that, setting DESTDIR right, and doing a make installworld installkernel.
Alternatively, you can dump the entire file system of a working install onto the partition - I recently did something like that with pax, nc, a FIXIT shell from the amd64 install CD, and a small FreeBSD install in virtualbox as the source.
You can also manually do whatever sysinstall does - I'm sure it's easy, but I've never looked at where it extracts from or how.

But now - sleep. I should ideally have been in bed seven hours ago - it's getting annoyingly bright outside. x)
 
Thanks

That looked/sounded complicated.

So here are my options (to summarise) in order to install FreeBSD successfully onto a Logical Partition, I'd have to do one of the following;
  1. Install FreeBSD onto a primary partition, then install another FreeBSD onto a logical partition, next remove FreeBSD from the Primary partition, then install Solaris or OpenSolaris in its stead. Then [try and] add FreeBSD to its GRUB.
  2. Install Solaris or OpenSolaris onto a Primary Partition. This includes a modified version of GRUB with an added capability which can boot ZFS. Then installing FreeBSD onto a Logical Partition.
  3. Use the convert tool included in Acronis Disk Director (and GParted?) which allows for conversion from Primary to logical and vice-versa.
  4. Mess around with sysinstall, add the capability to install to logical partition
  5. Create a working FreeBSD installation within a Virtual Machine, then 'dump' that virtual machine to the logical partition
I'll try the 1st one 1st, since I've been having a little trouble with Solaris and OpenSolaris...

Wish me luck!

Panarchy

PS: If there are any other ideas on how I could get FreeBSD successfully installed onto a Logical Partition, please post 'em!
 
There is one more alternative that's probably easier:
Boot from the amd64 CD, start a Fixit shell, and extract freeBSD onto the logical partition in whatever way and from whatever source sysinstall normally does.

I'll play a bit with this and post here later.
 
Sure, though keep in mind that I need to know the exact commands, as I've never done something like this before.

Thanks
 
Why not move your OSX or Vista to a logical partition and put BSD in the partition left by whichever one of the two you moved around.
 
I did this once years ago, but forgot the details. Anyway, you can put /boot on a primary partition, and everything else on a "logical" partition. But you can't do it from the installer, you have to get the system there with other means (buildworld for example).

p.s. You might also need some other stuff on the primary partition, like /sbin, but I can't remember.
 
I had (I think) /tmp and /usr in an extended fat32 partition
in 5.0 or 5.1, and panic-reboots often. I don't know if the panics
were due to inadequate cooling or not. If your data is valuable I'd
somehow manage to put it on something conventional. Also, if you
concentrate only on two (osx/linux) (osx/bsd) (linux/bsd) etc, you
have more time to keep each upto speed for usefulness, ports/programs
updated, and more time to backup data. (Not applicable if you have
a genuine reason to need more)
 
Well I'll be installing all these operating systems for 3 main reasons.
  1. Learn each operating system to an adequete extent (usable, can do everything I need to)
  2. Benchmark every operating system against eachother (speed)
  3. Benchmark Virtual Machines running on VMware with each OS

:stud

BrandyBuck, could I use the /boot from Solaris?

FBSDuser, I need Windows 7 to have the primary, otherwise I don't have a bootloader for my windows partitions. I couldn't install any version of Windows without having 1 primary boot partition.

Djn: Still waiting for what commands I should use.

Thanks for all antecedent and subsequent replies,

Panarchy
 
It's kind of a research project, and I've been slightly busy today - afraid to say so, but you don't get top priority. ;)
I'll make an attempt to look at it tomorrow, though.
 
Djn said:
It's kind of a research project, and I've been slightly busy today - afraid to say so, but you don't get top priority. ;)
I'll make an attempt to look at it tomorrow, though.

Awww... I'm not your top priority?

x(

LOL

Okay, well in the meantime, whilst you get your other priorites out of the way I'll go back to working with my Virtual Machines, creating Group Policies and my own Linux distributions...

Good luck (and wish me the same!)

Panarchy

�e
 
for step 2 I'd save time and check the
freebsd-questions list over the last several years.
Maybe even step 3.
As to step 1, IMHO Freebsd by itself you could spend 24 hours a day
and not even approach learning all you can do with it. (in 2004 there
were maybe 9000 ports, now probably twice that)
 
As for step 1, as soon as I work out how to use it's APT equivalent, then I'll be well on my way to achieving my goal.
 
Panarchy said:
Well I'll be installing all these operating systems for 3 main reasons.
  1. Learn each operating system to an adequete extent (usable, can do everything I need to)
  2. Benchmark every operating system against eachother (speed)
  3. Benchmark Virtual Machines running on VMware with each OS

Unless you install all three OSes into the same location on the disk (ie clean installs for each OS), your benchmarks won't really be valid. HDs have different performance for the inner parts of the disk, compared to the outer part of the disk. Seek times and latency are also different.

Using a single disk with multiple partitions for each OS is almost pointless. You're better off to go with either clean installs for each OS on the same disk, of using multiple identical disks. Although the latter can also lead to inaccuracies in the benchmark results.
 
Panarchy said:
BrandyBuck, could I use the /boot from Solaris?

I seriously doubt it. The /boot contains the kernel, modules and other boot stuff. If it was on a filesystem native to both OS's, and there were no name clashes, then I suppose it might work, but that's a lot of assuming.
 
Right, I have managed to install FreeBSD to a logical partition using only the 7.1 amd64 livefs CD. All of this was done in a virtualbox, but it should be equally doable on real hardware.
I have not tried to boot it. I can't even guarantee that the existing grub will be happy afterwards, though I don't think it will interfere.

edit: Right, I've messed up some detail in the partition layout. Oops - let me find out what I did wrong before anyone attempts to duplicate this. And *sigh* - 8 AM is no time to be going to bed ...


The starting point
I'm using a 20GB hard disk image.
I installed openSuSE (i386) with a custom partition layout:
One extended partition covering the disk, carved into three logical partitions: 512MB swap, 8GB root file system, and 11.5GB unformatted.
gpart.png


The extended partition is the first (and only) partition on the disk, so it'll be s1 in FreeBSD. If it's on the first ata HD, it's ad0s1 - which is what it was called for me, and what I'll use.

Fun with fixit
I only had an amd64 livefs image at hand and couldn't be bothered downloading an i386 one for this - it shouldn't matter.
At the loader menu, press 6 (Escape to loader prompt):
Code:
[b]OK[/b] load geom_part_mbr
[b]OK[/b] boot

In sysinstall, choose Fixit, CD/DVD . This will drop you at a shell.
Code:
[b]Fixit#[/b] geom part list ad0s1 | less
This will give you some information on the extended partition and the logical partitions in it. You're interested in the "first" and "last" numbers for the entire partition, and the "length" and "offset" for all the detected logical partitions (which will be under "Providers"). The logical partitions will have names like "ad0s1s1" and "ad0s1s2". (You can read these names as descending into a hierarchy: atadisk0 -> slice 1 -> slice 1 )


If the empty logical partition you want to use is listed here, great. If not, you have to create it; this was the case for me.
The first/last numbers are 512-byte sectors, while the length/offset numbers are in bytes. For me, the numbers looked like this:

geom_part.png


ad0s1:
First->last (sectors): 63 -> 41913584
First->last (bytes): 32256 -> 21459755008
Length (calculated) : 21459722752 bytes / 41913521 sectors

ad0s1s1 (linux swap):
Offset: 32256 bytes
Length: 534610944 bytes
Position (bytes): 32256 -> 534643200

ad0s1s2 (linux / ):
Offset: 534643200 bytes
Length: 8587192320 bytes
Position (bytes): 534643200 -> 9121835520

The free space is between the end of the last logical partition and the end of the extended partition:
Offset (bytes): 9121835520 (end of previous logical partition)
Length (bytes): 21459755008 - 9121835520 = 12337919488

To create the partition, I use gpart add, which wants all number in blocks: Just dividing by 512 will work.

Code:
[B]Fixit# [/B]gpart add -b 17816085 -s 24097499 -t freebsd ad0s1
ad0s1s3 added


With the logical partition in place, the next step is to use bsdlabels to carve it up a bit. My desired layout looks like this:
Code:
a: 2GB /
b: 1GB swap
(c: reserved)
d: the rest /usr

First, create a new disklabel and look at it:
Code:
[B]Fixit# [/B]bsdlabel -w ad0s1s3
If you don't like vi:
[B]Fixit# [/B]export EDITOR="ee"
[B]Fixit# [/B]bsdlabel -e ad0s1s3

bsdlabel_before.png


The partition called a covers the entire usable area, so we'll split that up into parts. The length and offset numbers are in 512 byte sectors again. Using the rough numbers from above, we want this:
Code:
a: 4194304 long, starting at 16 : ends before 4194320
b: 2097152 long, starting at 4194320: ends before 6291472
d: 24097421 - (4194304 + 2097152) = 17805965 long , starting at 6291472

Editing the disklabel to fit gives this:
bsdlabe_after.png

Save and exit - that will write the label.

Now, to format and mount the new partitons, and leave the fixit shell. I'll use softupdates (-S) on /usr but not on / ; it's arguably a conservative choice.
Code:
[B]Fixit# [/B]newfs /dev/ad0s1s3a
[B]Fixit# [/B]newfs -S /dev/ad0s1s3d
[B]Fixit# [/B]mkdir /dest
[B]Fixit# [/B]mount /dev/ad0s1s3a /dest
[B]Fixit# [/B]mkdir /dest/usr
[B]Fixit# [/B]mount /dev/ad0s1s3d /dest/usr
[B]Fixit# [/B]exit
Back in sysinstall, leave the fixit menu, and go to Configure.
Under Options, set Install Root to /dest .
Under distributions, check the ones you want - for now, just base and kernel (and probably man) will do.
This should take you to the media select screen, if not, select Media.
If your network card works, I'd suggest an FTP install - I didn't get a CD install to work, so I suspect the relevant files aren't on the livefs image.

When that finishes, you have a very sparse FreeBSD install in a logical partition.

Post-install setup
I haven't tried to make this boot yet, that's definitely for another evening (the sun is already up here and I need a few hours of sleep). I'd suggest doing a few things now, though; they seem sensible.

Go back to the Fixit shell, and edit /etc/fstab (with vi or ee, as you prefer); you want something like this:
Code:
/dev/ad0s1s3a    /      ufs    rw    1  1
/dev/ad0s1s3d    /usr   ufs    rw    2  2
/dev/ad0s1s3b    none   swap   sw    0  0

You most likely want to load geom_part_mbr at boot, too. Edit /boot/loader.conf, and add geom_part_mbr_load="YES".

The next step is to set up grub. I think. Assuming that the above can be made to boot.
 
Djn said:
Right, I have managed to install FreeBSD to a logical partition

Cool! I don't have the time to test this for the moment.

It would be nice to move your post to the Howtos & FAQ section of the forum.
 
Back
Top