# Need to install FreeBSD on a Linux LVM2 partition



## SIG_IGN (Mar 23, 2010)

Firstly, let me confess I have never used FreeBSd  before. and I have Linux LVM setup on my laptop. Currently there are two distros opensuse and Debian (Lenny) installed and they are booting fine with GRUB. I have a two primary partition one for (/boot) and  the other is swap. Rest 140 GB is Linux LVM. I have a logical volume of about 25GB free say for example (/dev/lenovo/bsd) . How can I install FreeBSD on this particular partition and configure grub accordingly to boot FreeBSD ? Waiting for some quick comments ,,,,


----------



## SirDice (Mar 23, 2010)

SIG_IGN said:
			
		

> How can I install FreeBSD on this particular partition and configure grub accordingly to boot FreeBSD ?


Quick and simple answer: you can't.


----------



## phoenix (Mar 23, 2010)

Delete the logical volume.  Shrink the volume group by 10GB or so.  Shrink the physical volume by the same.  And then create a normal, primary partition using the free space.  After that, install FreeBSD as per normal into that primary partition.


----------



## diablito (Mar 28, 2010)

*lvm, fbsd and multiboot system*

this thread prompts further questions. i'd like to set up a fedora, debian, fbsd multiboot system. after wrestling with geom_linux_lvm i finally read this thread (again) and realized that (at my level) using it on pre-existing lvm config is a wee bit more than i can chew. so my fdisk config would be this roughly:

/dev/sda1 200M (to make available as /boot on fedora)
/dev/sda2 200M ("  "    "         "  "     "  debian)
/dev/sda3 ~100G separate primary partition for entire fbsd system
/dev/sda4 205G lvm volume group hosting fedora & debian 100G each and 5G shared swap 
unused   100+G room to grow

thoughts & questions:
1. unfortunately no separate /boot partition for fbsd. any drawbacks putting entire system on a single slice, particularly in this instance? purpose of this install is purely educational.

2. unused space on drive (100+G) would be available for expansion if needed. it seems this would be available via lvm or (g)vinum for fedora/debian *and* fbsd respectively. is this correct?

3. ???

TIA for your thoughts ï¿½e


----------



## diablito (Mar 30, 2010)

*Grub & *bsd*



			
				SirDice said:
			
		

> Quick and simple answer: you can't.



really? with some simple modifications (system id set to 166) of the partition layout i mentioned previously i am booting openbsd from grub just fine. is freebsd so different? entering the following lines in my grub.conf do the trick:


```
title *BSD                   #this is the menu selection that appears in grub  
     rootnoverify (hd0,2)    #hd0=1st hard drive, 2=3rd partition which is my OpenBSD slice
     makeactive              #additional commands for grub so that it processes through
     chainloader +1          #its necessary steps.
```
simpler than i thought. 

is freebsd an exception?


----------



## diablito (Mar 30, 2010)

*lvm and GRUB*

apologies. my setup is not booting an lvm partition. i followed phoenix's advice and obtained a successful result.

i am wondering whether loading geom_linux_lvm at boot might not make it possible though...?


----------



## vermaden (Mar 31, 2010)

@diablito

It provides read only access to LVM metadata currently:



			
				&quot said:
			
		

> The parser is able to read LVM2 Text Format metadata,
> the logical volumes will be assembled and made available
> under /dev/linux_lvm/. The metadata is readâ€only,
> logical volumes cannot be allocated or resized.



@SIG_IGN

You need to give FreeBSD _one primary partition_, no other options are possible.


----------



## dav (Mar 31, 2010)

diablito said:
			
		

> ```
> title *BSD                   #this is the menu selection that appears in grub
> rootnoverify (hd0,2)    #hd0=1st hard drive, 2=3rd partition which is my OpenBSD slice
> makeactive              #additional commands for grub so that it processes through
> ...



I'm curious, why are you using chainloader+1?


----------



## phoenix (Mar 31, 2010)

diablito said:
			
		

> thoughts & questions:
> 1. unfortunately no separate /boot partition for fbsd. any drawbacks putting entire system on a single slice, particularly in this instance? purpose of this install is purely educational.



FreeBSD doesn't need or use a separate /boot except in some very specific circumstances.  Just leave /boot as a directory under the / filesystem.

Using a single slice (fdisk partition) is recommended.  Just create your FreeBSD partitions inside of that slice.



> 2. unused space on drive (100+G) would be available for expansion if needed. it seems this would be available via lvm or (g)vinum for fedora/debian *and* fbsd respectively. is this correct?



FreeBSD can use diskspace that is part of a DOS Extended Partition/Logical Partition just fine.  It just can't be installed to a logical partition.


----------



## diablito (Mar 31, 2010)

*grub*

@ dav: mistake. i did a copy paste and clearly wasnt paying attn. apologies. it works just fine without the chainloader.


----------



## diablito (Mar 31, 2010)

*more on grub*

apologies for excessive posts, wish i could edit them instead (though stating things clearly and correctly the 1st time would also be nice).

@dav: i need to rethink that. the chainloader +1 entry is needed to hand the boot process over to the bsd boot loader. there may be other incantations on grub that would work, but this is the one that worked for me.


----------



## phoenix (Mar 31, 2010)

chainloader is the poor-man's way to do it, as there is no intelligence involved.  GRUB just loads the first sector of whatever disk/partition it's pointed at, and then passes control over to it.  Really only useful for filesystems and kernels that GRUB doesn't understand natively.

For proper support, where GRUB knows what's happening, you specify a proper "root (hd0,3,a)" entry (that points at the *a* partition inside of the *3* slice inside of the *0* disk, modify as needed for your own disk setup) and a proper kernel entry (pointed at /boot/loader).


----------



## dav (Apr 1, 2010)

Thanks - I thought chainloader was a windows kludge but I wasn't sure. 

[ I btw, hve freebsd installed w/ no errors! Once I figure out how to launch it from grub, I'll see if it will boot]


----------

