Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* "Replacing" a subvolume in presence of nested subvolumes
@ 2024-07-10  4:35 intelfx
  2024-07-10 17:25 ` Goffredo Baroncelli
  0 siblings, 1 reply; 2+ messages in thread
From: intelfx @ 2024-07-10  4:35 UTC (permalink / raw)
  To: linux-btrfs

[-- Attachment #1: Type: text/plain, Size: 1646 bytes --]

Hi,

I'm currently developing a sort of high-level management CLI for btrfs
(loosely modeled after zfs CLI) and I believe I've hit a pretty crucial
missing feature in btrfs.

Given a subvolume tree like this:

FS_ROOT
├── foo
│   ├── baz
│   │   ├── foosub1
│   │   └── foosub2
│   └── foosub3
└── bar

Does there exist a way to atomically replace (or exchange) `foo` with
`bar`, preserving the nested subvolumes at their logical places (i.e.
beneath the new `foo`?

I'm pretty sure the answer right now is "no", but what I'm wondering
is: what would it take to implement something like it in btrfs? Or can
it be emulated with a clever sequence of VFS operations?

I tried to mess around with bind mounts to "emulate" this
functionality, but I don't see a way around it — if a directory is a
mountpoint, there is very little you can do with it.

This feature (or, rather, its absence) is in the way of implementing a
sort of "rollback" feature (in the hierarchy above, imagine that `bar`
is a snapshot of `foo` that the user wants to restore).

Now of course it is possible to take an easy way out by saying that
nested subvolumes are broken, but I don't think that would fly: nested,
user-creatable subvolumes are a very useful concept, docker/podman
creates them when used with a corresponding driver, etc. While for
system-wide docker/podman you can get around this by creating a top-
level `/docker` or `/podman` subvolume and mounting it into `/var/lib`,
this won't work for rootless podman.

Thoughts? Ideas?

-- 
Ivan Shapovalov / intelfx /

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 862 bytes --]

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

end of thread, other threads:[~2024-07-10 17:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-10  4:35 "Replacing" a subvolume in presence of nested subvolumes intelfx
2024-07-10 17:25 ` Goffredo Baroncelli

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