1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need to install FreeBSD on a Linux LVM2 partition

Discussion in 'Installing and Upgrading FreeBSD' started by SIG_IGN, Mar 23, 2010.

  1. SIG_IGN

    SIG_IGN New Member

    Messages:
    1
    Thanks Received:
    0
    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 ,,,, :)
     
  2. SirDice

    SirDice Moderator Staff Member Moderator

    Messages:
    17,628
    Thanks Received:
    2,385
    Quick and simple answer: you can't.
     
  3. phoenix

    phoenix Moderator Staff Member Moderator

    Messages:
    3,450
    Thanks Received:
    770
    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.
     
  4. diablito

    diablito New Member

    Messages:
    5
    Thanks Received:
    0
    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
     
  5. diablito

    diablito New Member

    Messages:
    5
    Thanks Received:
    0
    Grub & *bsd

    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:

    Code:
    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?
     
  6. diablito

    diablito New Member

    Messages:
    5
    Thanks Received:
    0
    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...?
     
  7. vermaden

    vermaden Well-Known Member

    Messages:
    2,364
    Thanks Received:
    677
    @diablito

    It provides read only access to LVM metadata currently:

    @SIG_IGN

    You need to give FreeBSD one primary partition, no other options are possible.
     
  8. dav

    dav New Member

    Messages:
    6
    Thanks Received:
    0
    I'm curious, why are you using chainloader+1?
     
  9. phoenix

    phoenix Moderator Staff Member Moderator

    Messages:
    3,450
    Thanks Received:
    770
    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.

    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.
     
  10. diablito

    diablito New Member

    Messages:
    5
    Thanks Received:
    0
    grub

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

    diablito New Member

    Messages:
    5
    Thanks Received:
    0
    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.
     
  12. phoenix

    phoenix Moderator Staff Member Moderator

    Messages:
    3,450
    Thanks Received:
    770
    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).
     
  13. dav

    dav New Member

    Messages:
    6
    Thanks Received:
    0
    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]