public inbox for linux-bcachefs@vger.kernel.org
 help / color / mirror / Atom feed
* Mounting subvolumes or subtrees
@ 2023-08-20 19:11 Linus Heckemann
  2023-08-22 19:33 ` Kent Overstreet
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Heckemann @ 2023-08-20 19:11 UTC (permalink / raw)
  To: linux-bcachefs

Hi all!

I'd like to use bcachefs as my root filesystem -- but I don't want / to
be the root of the filesystem.

This is achievable with btrfs using subvolume mounts (passing -o
subvol=... or -o subvolid=... to the mount program), but having looked
at the way it's handled on the kernel side (duplication of code from
fs/super.c in fs/btrfs/super.c) I'm pretty sure that's not something
that should be repeated in bcachefs.

It can also be done by having an initramfs that mounts the root of the
filesystem, then bind-mounts a subpath of that and
switch_root/pivot_root-ing into the bind mount. However, this approach isn't
representable in a classic fstab -- the root of the filesystem needs to
be mounted somewhere, but given that I want the subtree to be /, we have
nowhere to mount it.

One idea I have -- and I haven't read enough code yet to tell whether
the APIs already support this -- is that the new mount API
(fsopen/move_mount flow) could be used as-is or extended to support
mounting a subtree of a filesystem without needing an intermediate mount
of its root. This would allow _all_ filesystems to benefit from this
ability, not just bcachefs -- and to represent this as a "fake mount
option", much like X-mount.mkdir, in util-linux, making it possible to
put this type of mount in an fstab.

I'd appreciate any opinions on whether my thoughts make sense, and how
else my goal might be achievable.

Cheers
Linus

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

end of thread, other threads:[~2023-09-18 15:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-20 19:11 Mounting subvolumes or subtrees Linus Heckemann
2023-08-22 19:33 ` Kent Overstreet
2023-09-18 13:08   ` Linus Heckemann

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