You are not logged in.

#1 2009-12-08 21:28:14

gonX
Member
From: Denmark
Registered: 2009-08-16
Posts: 112

BTRFS, btrfs-side striping/RAID0, and rootfs

Ok guys, I got a pretty odd problem here.

What I'm doing (or what I'm attempting to do) is to have BTRFS as my root file system. Both metadata and data is connected to the RAID0 feature of BTRFS itself, and it's hard to actually make this mount successfully.

What I've tried so far (none of which even remotely worked):

- Making an initrd from defaults (obviously didn't work since BTRFS is unheard of for the most part in initcpio)
- Making my own hook for btrfs itself. (I probably didn't do it right). It went something like:

/sbin/modprobe btrfs
/usr/bin/btrfsctl -a
/bin/sleep 2
/usr/bin/btrfsctl -a

(and then of course with the rest of the required code, and yes I remembered to add it to mkinitcpio.conf, and yes I remembered to remake the image)
And then in the install script I had btrfs as a module, btrfsctl as a binary and so on.

- Then the same as above, but with BTRFS integrated into the kernel (not as a module)
- tried rootfstype= kernel parameter

First question I have... how do I fix this?
It works from a Sidux LiveCD by installing btrfs-progs, then doing a 'modprobe btrfs', and then doing a 'btrfsctl -a'. Then my root fs is mountable.
However, it seems like it doesn't work (or it runs all the hooks independently at the same time).

My setup:
5x random 200-250GB harddrives.

Partitioning:
100MB RAID-1 over all 5 harddrives. - sd{a..e}1
5x256MB swap over all harddrives sd{a..e}2
5x~200GB BTRFS-side raid-0 (NOT MDADM) over all harddrives. sd{a..e}3
3x50GB unused space. sd{b..d}4

I have a P45 chipset if it helps any... although I doubt it does.

A second question I have - is there any way to break or otherwise stop initrd/initcpio so that it spawns a shell before trying to mount the root FS? I'd like to see if it works manually that way.

Last edited by gonX (2009-12-08 21:30:55)


since 2009

Offline

#2 2009-12-08 22:21:40

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 858
Website

Re: BTRFS, btrfs-side striping/RAID0, and rootfs

One way to get a shell is to give root=/dev/nonexistentdevice as a kernel parameter.

Also, when you made your own hook did you add /usr/bin/btrfsctl and the btrfs module to the ramdisk?

Offline

#3 2009-12-09 06:03:21

gonX
Member
From: Denmark
Registered: 2009-08-16
Posts: 112

Re: BTRFS, btrfs-side striping/RAID0, and rootfs

Yes I did. I verified that it actually got included by running 'bsdtar -t -f <file> | grep btrfsctl'
Thanks for the help so far. I will try the shell now.

*EDIT*

I can't make it spawn a shell, unfortunately hmm I tried both without and with a root parameter pointing at an invalid device (hell I tried asfasdasd as a root device to make sure that it wasn't actually an existing device, lol)

Last edited by gonX (2009-12-09 06:08:11)


since 2009

Offline

#4 2009-12-09 06:26:24

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 858
Website

Re: BTRFS, btrfs-side striping/RAID0, and rootfs

Weird.  'Cause I agree, getting a shell is probably the best way to diagnose this.  How about sticking "/bin/sh" in your custom hook's commands?

Offline

#5 2009-12-09 06:53:53

gonX
Member
From: Denmark
Registered: 2009-08-16
Posts: 112

Re: BTRFS, btrfs-side striping/RAID0, and rootfs

Since adding /bin/sleep 5 in my hook does not seem to work at all, I don't think that would work.


since 2009

Offline

#6 2009-12-09 07:20:58

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 858
Website

Re: BTRFS, btrfs-side striping/RAID0, and rootfs

Oh it didn't even sleep for 2 seconds?  In that case you should make sure of a few things:
- The commands for your hook are in a function called run_hook().  For example, this would be the contents of /lib/initcpio/hooks/btrfs:

run_hook()
{
  /sbin/modprobe btrfs
  /usr/bin/btrfsctl -a
  /bin/sleep 2
  /usr/bin/btrfsctl -a
}

- You have SCRIPT="<hook name>" in the install() function in the install file for your hook.  For example, /lib/initcpio/install/btrfs could look like this:

install() {
  MODULES="btrfs"
  BINARIES="/usr/bin/btrfsctl"
  SCRIPT="btrfs"
}

help() {
    echo "This hook hopefully gets gonX's btrfs root working."
}

Last edited by tavianator (2009-12-09 07:21:24)

Offline

#7 2009-12-09 07:42:36

gonX
Member
From: Denmark
Registered: 2009-08-16
Posts: 112

Re: BTRFS, btrfs-side striping/RAID0, and rootfs

My current initcpio/install/btrfs:

install ()
{
MODULES="btrfs"
BINARIES="/usr/bin/btrfsctl"
FILES=""
SCRIPT="btrfs"
}

help ()
{
cat<<HELPEOF
 asdasd
HELPEOF
}

initcpio/hooks/btrfs:

run_hook ()
{
/sbin/modprobe btrfs
/usr/bin/btrfsctl -a
/bin/sleep 2
/usr/bin/btrfsctl -a
}

As you can see, that's already what I had.
My /etc/mkinitcpio.conf:

MODULES=""
BINARIES=""
FILES=""
HOOKS="base udev autodetect pata scsi sata btrfs filesystems"
COMPRESSION="lzma"

since 2009

Offline

#8 2009-12-09 08:19:51

gonX
Member
From: Denmark
Registered: 2009-08-16
Posts: 112

Re: BTRFS, btrfs-side striping/RAID0, and rootfs

You know, I think I partially figured it out. I'm using a custom kernel and I remember not including initrd support in it.

New problem though; it does not modprobe btrfs correctly. Give me a moment and I'll try including grep in my initrd, modprobe tells me to look in dmesg, which I can't do without grep or less/more.

Last edited by gonX (2009-12-09 08:21:29)


since 2009

Offline

#9 2009-12-09 08:30:05

gonX
Member
From: Denmark
Registered: 2009-08-16
Posts: 112

Re: BTRFS, btrfs-side striping/RAID0, and rootfs

OK! Wow. I got it to mount from the initrd now (mkdir /mnt && mount -t btrfs /dev/sda3 /mnt), but I reused my old name so my kernel has btrfs integrated AND as a module right now. It breaks the initrd. brb making new kernel

Last edited by gonX (2009-12-09 08:31:41)


since 2009

Offline

#10 2009-12-09 08:37:13

gonX
Member
From: Denmark
Registered: 2009-08-16
Posts: 112

Re: BTRFS, btrfs-side striping/RAID0, and rootfs

It boots!


since 2009

Offline

#11 2009-12-09 11:54:23

Mikko777
Member
From: Suomi, Finland
Registered: 2006-10-30
Posts: 837

Re: BTRFS, btrfs-side striping/RAID0, and rootfs

Interesting!

Wiki material for sure when you get it to work smile

Offline

#12 2009-12-09 12:31:02

gonX
Member
From: Denmark
Registered: 2009-08-16
Posts: 112

Re: BTRFS, btrfs-side striping/RAID0, and rootfs

Yep, I got it to work. I might edit the Wiki to include how to set this up.


since 2009

Offline

Board footer

Powered by FluxBB