linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Duncan <1i5t5.duncan@cox.net>
To: linux-btrfs@vger.kernel.org
Subject: Re: booting from BTRFS works only with one device in the pool
Date: Mon, 1 Feb 2016 23:02:42 +0000 (UTC)	[thread overview]
Message-ID: <pan$10266$74d6d340$652029ad$fa234679@cox.net> (raw)
In-Reply-To: 20160201221120.GD8313@carfax.org.uk

Hugo Mills posted on Mon, 01 Feb 2016 22:11:20 +0000 as excerpted:

> On Mon, Feb 01, 2016 at 10:31:47PM +0100, Hendrik Friedel wrote:
>> Hello,
>> 
>> I am running CentOS from a btrfs root.
>> This worked fine until I added a device to that pool:
>> btrfs device add /dev/sda3 /
>> reboot
>> 
>> This now causes the errors:
>> BTRFS: failed to read chunk tree on sdb3 BTRFS: open_ctree failed
>> 
>> Here  I am stuck in a recovery prompt.
>> 
>> btrfs fi show displays the file system correctly with 2.1GiB used for
>> sdb3 and 0.00GiB used on sda3
> 
> By far the simplest and most reliable method of doing this is to
> use an initramfs with the command "btrfs dev scan" in it somewhere
> before mounting. Most of the major distributions already have an
> initramfs set up (as does yours, I see), and will install the correct
> commands in the initramfs if you install the btrfs-progs package
> (btrfs-tools in Debian derivatives).
> 
> The other approach is to add "device=/dev/sda3,device=/dev/sdb3" to
> the "rootflags=" option on the grub command line, but that's going to
> break if your kernel or hardware decides to reorder your devices.

As a btrfs user with a two-device btrfs root filesystem who has had to 
deal with this same problem myself...

Unless the problem has been fixed in very recent kernels, device= doesn't 
work in rootflags= for btrfs on the kernel commandline in any case.  I 
don't know why, but I suspect it might be the fact that with 
rootflags=device=, there's at least two =, and the kernel may split it at 
the wrong = and instead of seeing a rootflags= option it knows what to do 
with, it sees a rootflags=device= option that it ignores as making no 
sense, making it a kernel commandline parsing bug.  Alternatively, 
another poster hinted that the kernel may get it correct, but btrfs for 
some reason can't use device= in the form it gets passed in from 
rootflags=, while it can use it when passed in from userspace, which 
would make it a btrfs bug.

Either way, (1) the problem isn't new and has been there for quite some 
time, since early in the kernel 3.x era at least, but (2) other options 
such as degraded _can_ be passed successfully by rootflags=, so btrfs can 
use rootflags= in general, it just has problems with device=, for 
whatever reason.

Which means...

> Do the sensible thing and just use the initramfs solution.

Exactly.

For over a decade I used reiserfs on / and was able to avoid an initr* 
entirely.  And single-device btrfs / works without an initr*.  But multi-
device... not so much.  While I definitely wasn't thrilled at the 
prospect of having to complicate my boot process with an initr* that 
_shouldn't_ be necessary, and had to spend some time learning about initr* 
(I had initially dumped initr* early in my Linux experience and hadn't 
had to learn about them until I tried multi-device btrfs /) so as to be 
able to satisfy myself that I could work with it in both normal operation 
and disaster recovery scenarios...

At this point there's really only two choices if you want multi-device 
btrfs /, either use an initr* and have your multi-device btrfs /, or give 
up on multi-device btrfs / and be satisfied with a more traditional 
single-device /, btrfs or otherwise.

Well, unless you're a kernel-level dev sufficiently motivated to look 
into the problem, devise a patch to solve the problem, and get that patch 
thru the approval process and into kernel mainline.  In that case there's 
three options, and I dearly wish someone with the necessary kernel level 
coder qualification would take that third option, making initr*less multi-
device btrfs / a viable option for the rest of us who in the mean time 
are stuck with only the first two options!

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman


  reply	other threads:[~2016-02-01 23:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-01 21:31 booting from BTRFS works only with one device in the pool Hendrik Friedel
2016-02-01 22:11 ` Hugo Mills
2016-02-01 23:02   ` Duncan [this message]
2016-02-01 23:15     ` Hugo Mills
2016-02-02 22:01   ` Hendrik Friedel
2016-02-02 22:06     ` Chris Murphy
2016-02-03  6:31       ` Hendrik Friedel
2016-02-02 22:09     ` Hugo Mills
2016-02-01 23:29 ` Chris Murphy
2016-02-02 21:59   ` Hendrik Friedel
2016-02-02 22:04     ` Chris Murphy
2016-02-03 18:14       ` Hendrik Friedel
2016-02-03 20:30         ` Chris Murphy
2016-02-03 22:19           ` Chris Murphy
2016-02-13 14:38             ` Hendrik Friedel
2016-02-13 18:20               ` Chris Murphy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='pan$10266$74d6d340$652029ad$fa234679@cox.net' \
    --to=1i5t5.duncan@cox.net \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).