Linux Documentation
 help / color / mirror / Atom feed
* [PATCH 0/8] btrfs: assemble a multi-device root filesystem without an initrd
@ 2026-11-16 22:43 Ismael Luceno
  2026-11-16 22:43 ` [PATCH 6/8] Documentation: btrfs: document waiting for the root filesystem devices Ismael Luceno
  2026-11-16 23:41 ` [PATCH 0/8] btrfs: assemble a multi-device root filesystem without an initrd Qu Wenruo
  0 siblings, 2 replies; 4+ messages in thread
From: Ismael Luceno @ 2026-11-16 22:43 UTC (permalink / raw)
  To: linux-kernel, linux-btrfs
  Cc: Ismael Luceno, David Sterba, Chris Mason, Christian Brauner,
	Alexander Viro, Jan Kara, linux-fsdevel, linux-doc

A multi-device btrfs root filesystem is normally assembled by the device
scanner that an initrd runs before mounting the root.  Without an initrd
nothing runs that scanner, so the root mount names a single device and
the rest of the array is left out.

This series lets btrfs assemble such a root filesystem in the kernel:

  * mount devtmpfs on the initial root before the root filesystem, so
    device nodes exist to open the other devices by name (init);
  * let a filesystem tell whether it is mounting the root device and read
    rootwait, and resolve root=UUID=/root=LABEL= values that name the
    filesystem rather than a partition (init/VFS);
  * scan all block devices for the remaining members of a btrfs root
    filesystem, and wait for all of them to appear before mounting.

The scan and wait are gated on CONFIG_BTRFS_ROOT_SCAN (default y) and
only act on the root mount when the user asked for it with rootwait, so
non-root mounts and systems without the option are unchanged.


Ismael Luceno (8):
  btrfs: add config options for the root device scan
  init: mount devtmpfs before the root filesystem
  init: let filesystems ask whether they are mounting the root device
  btrfs: add a helper to scan all block devices
  btrfs: wait for the root filesystem to have all its devices
  Documentation: btrfs: document waiting for the root filesystem devices
  init: let a filesystem resolve a root device by UUID or label
  btrfs: resolve root=UUID= and root=LABEL=

 Documentation/filesystems/btrfs.rst |  31 +++++
 fs/btrfs/Kconfig                    |  25 ++++
 fs/btrfs/super.c                    | 165 +++++++++++++++++++++++
 fs/btrfs/volumes.c                  | 196 ++++++++++++++++++++++++++++
 fs/btrfs/volumes.h                  |  25 ++++
 fs/filesystems.c                    |  37 ++++++
 include/linux/fs.h                  |  10 ++
 include/linux/root_dev.h            |  14 ++
 init/do_mounts.c                    |  51 +++++++-
 9 files changed, 553 insertions(+), 1 deletion(-)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 6/8] Documentation: btrfs: document waiting for the root filesystem devices
  2026-11-16 22:43 [PATCH 0/8] btrfs: assemble a multi-device root filesystem without an initrd Ismael Luceno
@ 2026-11-16 22:43 ` Ismael Luceno
  2026-11-16 23:41 ` [PATCH 0/8] btrfs: assemble a multi-device root filesystem without an initrd Qu Wenruo
  1 sibling, 0 replies; 4+ messages in thread
From: Ismael Luceno @ 2026-11-16 22:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ismael Luceno, Ismael Luceno, David Sterba, Chris Mason,
	Jonathan Corbet, Shuah Khan, Randy Dunlap,
	open list:BTRFS FILE SYSTEM, open list:DOCUMENTATION

Document the whole feature, including the part btrfs opens devices by
their /dev name and so cannot run the search at all without devtmpfs
mounted.  Say that too, and what happens when it is not, rather than
leaving a boot that stops with nothing in the log.

Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
Signed-off-by: Ismael Luceno <iluceno@suse.de>
---
 Documentation/filesystems/btrfs.rst | 31 +++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/Documentation/filesystems/btrfs.rst b/Documentation/filesystems/btrfs.rst
index a81db8f54d68..9dcdb87a53c3 100644
--- a/Documentation/filesystems/btrfs.rst
+++ b/Documentation/filesystems/btrfs.rst
@@ -33,6 +33,37 @@ The main Btrfs features include:
     * Read/write metadata verification
     * Online resize (shrink, grow)
 
+Multi-device root filesystem without an initrd
+----------------------------------------------
+
+A multi-device btrfs filesystem is normally assembled by the device scanner in
+userspace, which the initrd runs before mounting the root filesystem.  Without
+an initrd there is nothing to run that scanner, so the root filesystem is
+mounted from the single device named by ``root=`` and the remaining devices are
+left out.
+
+Given ``rootwait``, btrfs finds the rest of them during the root mount.
+
+    root=/dev/sda1 rootwait
+
+The devices are then given the time ``rootwait=`` specifies, or indefinite for
+``rootwait`` with no value.  The search repeats at the interval set by
+CONFIG_BTRFS_ROOT_SCAN_INTERVAL_MS (100 ms by default) until they are
+all found, and is not made for any other mount: a filesystem mounted later has
+been given the devices it needs, or is being mounted degraded on purpose.
+
+When the wait runs out btrfs mounts whatever it has, which for a redundant
+profile usually means the mount fails and the kernel panics; a warning is
+printed before that happens.  Without ``rootwait`` there is no wait at all, and
+an incomplete filesystem is mounted as usual.
+
+The search needs the device nodes in ``/dev``, which come from devtmpfs.  Where
+that is not mounted the search cannot start, and btrfs says so and gives up
+rather than waiting for something it can never find.
+
+The search is built with ``CONFIG_BTRFS_ROOT_SCAN``, which depends on
+``CONFIG_DEVTMPFS`` and is on by default.
+
 For more information please refer to the documentation site or wiki
 
   https://btrfs.readthedocs.io

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/8] btrfs: assemble a multi-device root filesystem without an initrd
  2026-11-16 22:43 [PATCH 0/8] btrfs: assemble a multi-device root filesystem without an initrd Ismael Luceno
  2026-11-16 22:43 ` [PATCH 6/8] Documentation: btrfs: document waiting for the root filesystem devices Ismael Luceno
@ 2026-11-16 23:41 ` Qu Wenruo
  2026-11-17 17:36   ` Ismael Luceno
  1 sibling, 1 reply; 4+ messages in thread
From: Qu Wenruo @ 2026-11-16 23:41 UTC (permalink / raw)
  To: Ismael Luceno, linux-kernel, linux-btrfs
  Cc: David Sterba, Chris Mason, Christian Brauner, Alexander Viro,
	Jan Kara, linux-fsdevel, linux-doc



在 2026/11/17 09:13, Ismael Luceno 写道:
> A multi-device btrfs root filesystem is normally assembled by the device
> scanner that an initrd runs before mounting the root.

What is the problem here?

Is generating an initramfs really that complex?

Multi-device filesystems/storage solution requires initramfs to do the 
scan, no matter if it's btrfs or device-mapper, it's already the common 
knowledge.

I just see no strong reasons to do this at all.

And Sashiko is already reporting over 10 high level problems, which is 
not a good sign either.
>  Without an initrd
> nothing runs that scanner, so the root mount names a single device and
> the rest of the array is left out.
> 
> This series lets btrfs assemble such a root filesystem in the kernel:
> 
>    * mount devtmpfs on the initial root before the root filesystem, so
>      device nodes exist to open the other devices by name (init);
>    * let a filesystem tell whether it is mounting the root device and read
>      rootwait, and resolve root=UUID=/root=LABEL= values that name the
>      filesystem rather than a partition (init/VFS);
>    * scan all block devices for the remaining members of a btrfs root
>      filesystem, and wait for all of them to appear before mounting.
> 
> The scan and wait are gated on CONFIG_BTRFS_ROOT_SCAN (default y) and
> only act on the root mount when the user asked for it with rootwait, so
> non-root mounts and systems without the option are unchanged.
> 
> 
> Ismael Luceno (8):
>    btrfs: add config options for the root device scan
>    init: mount devtmpfs before the root filesystem
>    init: let filesystems ask whether they are mounting the root device
>    btrfs: add a helper to scan all block devices
>    btrfs: wait for the root filesystem to have all its devices
>    Documentation: btrfs: document waiting for the root filesystem devices
>    init: let a filesystem resolve a root device by UUID or label
>    btrfs: resolve root=UUID= and root=LABEL=
> 
>   Documentation/filesystems/btrfs.rst |  31 +++++
>   fs/btrfs/Kconfig                    |  25 ++++
>   fs/btrfs/super.c                    | 165 +++++++++++++++++++++++
>   fs/btrfs/volumes.c                  | 196 ++++++++++++++++++++++++++++
>   fs/btrfs/volumes.h                  |  25 ++++
>   fs/filesystems.c                    |  37 ++++++
>   include/linux/fs.h                  |  10 ++
>   include/linux/root_dev.h            |  14 ++
>   init/do_mounts.c                    |  51 +++++++-
>   9 files changed, 553 insertions(+), 1 deletion(-)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/8] btrfs: assemble a multi-device root filesystem without an initrd
  2026-11-16 23:41 ` [PATCH 0/8] btrfs: assemble a multi-device root filesystem without an initrd Qu Wenruo
@ 2026-11-17 17:36   ` Ismael Luceno
  0 siblings, 0 replies; 4+ messages in thread
From: Ismael Luceno @ 2026-11-17 17:36 UTC (permalink / raw)
  To: Qu Wenruo
  Cc: linux-kernel, linux-btrfs, David Sterba, Chris Mason,
	Christian Brauner, Alexander Viro, Jan Kara, linux-fsdevel,
	linux-doc

On Tue, 17 Nov 2026 10:11:46 +1030
Qu Wenruo <wqu@suse.com> wrote:
> 在 2026/11/17 09:13, Ismael Luceno 写道:
> > A multi-device btrfs root filesystem is normally assembled by the
> > device scanner that an initrd runs before mounting the root.  
> 
> What is the problem here?
> 
> Is generating an initramfs really that complex?

Why depend on an initramfs?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-17 17:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16 22:43 [PATCH 0/8] btrfs: assemble a multi-device root filesystem without an initrd Ismael Luceno
2026-11-16 22:43 ` [PATCH 6/8] Documentation: btrfs: document waiting for the root filesystem devices Ismael Luceno
2026-11-16 23:41 ` [PATCH 0/8] btrfs: assemble a multi-device root filesystem without an initrd Qu Wenruo
2026-11-17 17:36   ` Ismael Luceno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox