# BTRFS and lilo

## jenkler

EDIT - GOOD TO KNOW:

-------

Enable CONFIG_BOOT_DELAY=y

Then append boot_delay=200 at lilo boot

-------

Hello everyone!

Just want to know is anyone has got it to work with lilo and btrfs

I want to boot af a 2 disk system in btrfs mirror mode from lilo native. No boot partition or initrd.

please share any findings  :Wink: 

----------

## Gusar

I know it's a stupid question, but I have to ask anyway, and you for sure have predicted that it will be asked. So here we go: Why?

Follow-up question: Have you considered syslinux?

----------

## Ant P.

You have four options:

Use an initrd.

Use a separate /boot partition.

Use a Btrfs-compatible bootloader.

Fix LILO yourself.

What you're asking is not currently possible.

----------

## jenkler

I relly want lilo  :Very Happy:  but i don't have the knowlage to patch it  :Sad: , in other wrods i need to wait

----------

## Etal

 *jenkler wrote:*   

> I relly want lilo 

 

What is it about LILO that you want?  :Wink: 

----------

## jenkler

 *Etal wrote:*   

>  *jenkler wrote:*   I relly want lilo  
> 
> What is it about LILO that you want? 

 

I love the Simpleness of lilo. but it seams that i can't get it to work ;-(

----------

## xaviermiller

Hello,

Syslinux (extlinux) is compatible with BTRFS, as I see in their websites. This could be an alternative to LILO.

(BTW I switched from GRUB to SYSLINUX because of GRUB2 mess)

----------

## jenkler

Raid 1:

mkfs.btrfs -m raid1 -d raid1 /dev/sda /dev/sdb

boot on usb stick (lilo in mbr) /dev/sdc 

mkfs.ext4 /dev/sdc

i have /dev/sda and /dev/sdb in raid1 setup without any partitions, msdos or GPT tables, just plain discs 

i boot from /dev/sdc with lilo and tried to append this but it does not work.

append = "root=/dev/sda rootfstype=btrfs rootflags=device=/dev/sda,device=/dev/sdb" 

I get this: http://imagebin.org/203685

if i do this only

append = "root=/dev/sda"     or use root = /dev/sda

I get this: http://imagebin.org/203687

it finds btrfs but is unable to setup the array

----------

## kingfame_147

Hi,

let's start with the second cmdline:

This is intend to happen :) You have a multi disk btrfs and don't do a "btrfs device scan". Therefore btrfs tries to mount a multi disk fs with only one known device with has to fail. append "rootflags=degraded" to your second cmdline and it will work. However, you will only use one device. In you case I would test this one time to see if your filesystem is ok.

First cmdline:

Unfortunately I never used lilo nor have any idea how to use it.

What I would do: Grab a live cd and play around a little bit. Do something like "mount -o degraded /dev/sda /mnt", then "mount -o device=/dev/sda,/dev/sdb /dev/sda /mnt" and see if it works. If this works there is something wrong the way you tell lilo to mount your root device. If this doesn't work there is something wrong with your filesystem.

----------

## jenkler

 *kingfame_147 wrote:*   

> The @root is just the name of a subvolume. What you normally do with btrfs:
> 
> Create a filesystem and then add subvolumes like @root, @etc, @var... Then you mount @root to /, @etc to /etc, @var to /var... Then you can snapshot and rollback the single subvolumes independently

 

But i only use mkfs.btrfs -m raid1 -d raid1 /dev/sda /dev/sdb  no subvolumes at all, are you sure that i don't need the subvol= for rootflags?

Is it possible that the rootflags is broken? i will test the degraded stuff when i home

My test is append="root=/dev/sda rootflags=degraded" <-- if that is not working the the rootflags is broken right?

as you kan see here http://imagebin.org/203681 the kernel commad line is correct or is it ? does it matter if i use grub, syslinux or lilo when iam at this stage?

mount -o degraded /dev/sda /mnt/gentoo <-- works great on live cd 

but then

root@sysresccd /root % mount -o device=/dev/sda,/dev/sdb /dev/sda /mnt/gentoo         

mount: /dev/sda already mounted or /mnt/gentoo busy

mount: according to mtab, /dev/sda is already mounted on /mnt/gentoo

Don't, another but 

mount -o remount,rw,device=/dev/sda,device=/dev/sdb -t btrfs /dev/sda /mnt/gentoo <-- works, seams to be correct

mount prints:

/dev/sda on /mnt/gentoo type btrfs (rw,device=/dev/sda,device=/dev/sdb)

root@sysresccd /root % btrfs filesystem show 

Label: 'dust'  uuid: c7e98b6b-3bb5-462a-a190-290d12575634

        Total devices 2 FS bytes used 1.76GB

        devid    2 size 465.76GB used 3.27GB path /dev/sdb

        devid    1 size 465.76GB used 3.27GB path /dev/sda

I also have:

/dev/sda        /               btrfs           device=/dev/sda,device=/dev/sdb         0       0

in fstab

----------

## kingfame_147

You don't need the subvol= part if you don't use subvolumes. btrfs creates a default subvolume which is mounted if no subvol= is used.

I actually don't know if the rootflags is broken, because I don't know how lilo handles those :( In image it looks like there is a = missing, like "rootflags device=/dev.." instead of "rootflags=/dev/...". But this could be because of the picture.

Syslinux isn't a bootloader, isn't it? It doesn't matter if you use grub or lilo, you just have to use the right syntax.

Live CD:

Ok, that's a good sign :) Your filesystem works. But don't use the degraded option as a workaround. It is only a test. Normally you use this option in a raid if one device is broken and you want to replace it.

The second test is failing because you have to umount the device first "umount /mnt/gentoo", then try the command again. If it works: There is something wrong with your lilo configuration. Somebody who know how to use lilo has to help you out then.

Btw: Why don't you just use dracut as an initramfs? It is very easy to setup and will really help you with btrfs.

----------

## Gusar

 *kingfame_147 wrote:*   

> Syslinux isn't a bootloader, isn't it?

 

LOL. Of course it is. A damn fine one. As simple as it gets and yet fully functional (well, except on my netbook, but I blame the netbook  :Smile: ).Last edited by Gusar on Fri Mar 16, 2012 12:20 pm; edited 1 time in total

----------

## jenkler

mount -o degraded /dev/sda /mnt/gentoo

then

mount -o remount,rw,device=/dev/sda,device=/dev/sdb -t btrfs /dev/sda /mnt/gentoo 

works and seams to be correct 

mount prints: 

/dev/sda on /mnt/gentoo type btrfs (rw,device=/dev/sda,device=/dev/sdb) 

but a workaround would be the degraded stuff + a remount from fstab or something.  I dont want any intird and i want to use lilo, thats why this case is so hard to break

lilo does not support btrfs so i have the usbstick workaround and it works. I hope that this degraded tuff is not the only solution for me ...

I hate initrd, grub, genkernel and modules, it so fucking blooted. Sorry

append="rootfstype=btrfs root=/dev/sda rootflags=device=/dev/sdb"

----------

## Gusar

jenkler, don't you think it'd be much simpler to just use another bootloader, instead of futzing around with usb sticks and such? You can't have that big of a loyalty to a bootloader. I'd get it if it was a userspace app that's exactly what you want. But bootloader? As much as I like syslinux, I immediately went to grub on my netbook. Because it simply works better on that crazy machine.

----------

## jenkler

Gusar: I love lilo because its simple and does not put alot of crap in the system + it silly but i have a boot logo that i like in lilo ;-D

I hate to giveup if its a small chance its possible to do this. There is allways gurus out there that know how to do it

----------

## jenkler

How do I create device files at boot time without an initrd  , anyone?

Do i need to patch something ?

----------

## Gusar

There's devtmpfs. If you need anything beyond that, not possible without an initramfs.

----------

## jenkler

 *Gusar wrote:*   

> There's devtmpfs. If you need anything beyond that, not possible without an initramfs.

 

Cool ;-D

Ok, i only need to map /dev/sda and /dev/sdb at boot time, is the possible?

CONFIG_DEVTMPFS <-- hmm  sounds cool

----------

## AngelKnight

 *jenkler wrote:*   

> How do I create device files at boot time without an initrd, anyone?
> 
> Do i need to patch something ?

 

To answer the question above: sufficiently-recent kernels have "devtmpfs" support.

But to the topic of this thread: BTRFS-on-/ without an initrd is probably not going to happen at this time if the / filesystem is a multi-disk BTRFS.

The primary problem is that the btrfs fs code will not reliably mount the disk at kernel start-time if something hasn't done "btrfs device scan" first.

As far as I know, at this time you can either hack up the kernel to start a tasklet that simulates all the userspace things "btrfs device scan" does (not likely easy without knowing which major/minor devices to open in advance), or give up and use an initrd.Last edited by AngelKnight on Sat Mar 24, 2012 10:42 am; edited 1 time in total

----------

## kingfame_147

@AngelKnight

As I mentioned before btrfs doesn't need the btrfs device can. You can simply mount any multi device btrfs with via

```
mount -o device=/dev/sda,/dev/sdb /dev/sda /mnt
```

This works with grub and should work with lilo.

@T

I don't understand why devtmpfs would help you with your problem. What about asking the lilo devs for help regarding your problems with the mount options. You tried 

```
mount -o remount,rw,device=/dev/sda,device=/dev/sdb -t btrfs /dev/sda /mnt/gentoo
```

and it worked. Therefore using this options should work at boot time, too. If not there is something going wrong which is not related to btrfs.

----------

## AngelKnight

[quote="kingfame_147"]@AngelKnight

As I mentioned before btrfs doesn't need the btrfs device can. You can simply mount any multi device btrfs with via

```
mount -o device=/dev/sda,/dev/sdb /dev/sda /mnt
```

If the disk layout changes (think BTRFS RAID1-data RAID1-metadata), the bootloader will reference non-existent devices for /.  This isn't a good idea if one wants a / that survives the loss of one disk.

----------

## kingfame_147

?! A loss of one disk isnt a problem at all. Just add the "degraded" option to the rootflags, replace the disk with a new one and remove the "degraded" option.

----------

