Skip to contentSkip to conversation

empty directory from previous subvolume in a snapshot is not sent|received

DISCUSSION Christoph Anton Mitterer 2 participants 5 messages Jun 22, 2023 – Jun 23, 2023 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Hey.

Not sure whether this is a bug or expected.

On my btrfs I have subvolumes like:
data/
2023-06-21/
where e.g. data/ contains the root filesystem and 2023-06-21/ is a ro- snapshot thereof.

When I created 2023-06-21/ from data/, the latter contained another (rw-)subvolume data/pictures/, which I've deleted (actually: moved out the files back to data/ and rmdir-ed the now empty subvol... or maybe I did btrfs subvolume delete - not sure anymore) again after creating the snapshot.

Now 2023-06-21/ contains an empty (non-subvolume) 2023-06-21/pictures/, which is expected.

Today I've send|received 2023-06-21/ to another btrfs (at that point, the original data/pictures/ subvolume was already gone), and diff -qr - -no-dereference-ed the two afterwards.

Outcome (apart from "differing" files/sockets/block/char special files) is that the target doesn't contain the empty pictures/ dir.

Not a big problem for me,... but is this expected or some kind of strange bug?

Thanks,
Chris.

#1 lore raw
Quoted 26 lines · Christoph Anton Mitterer

Hey.

Not sure whether this is a bug or expected.

On my btrfs I have subvolumes like:

   data/
   2023-06-21/

where e.g. data/ contains the root filesystem and 2023-06-21/ is a ro- snapshot thereof.

When I created 2023-06-21/ from data/, the latter contained another (rw-)subvolume data/pictures/, which I've deleted (actually: moved out the files back to data/ and rmdir-ed the now empty subvol... or maybe I did btrfs subvolume delete - not sure anymore) again after creating the snapshot.

Now 2023-06-21/ contains an empty (non-subvolume) 2023-06-21/pictures/, which is expected.

Today I've send|received 2023-06-21/ to another btrfs (at that point, the original data/pictures/ subvolume was already gone), and diff -qr - -no-dereference-ed the two afterwards.

Quoted 8 lines

Outcome (apart from "differing" files/sockets/block/char special files) is that the target doesn't contain the empty pictures/ dir.

Not a big problem for me,... but is this expected or some kind of strange bug?

I think it is expected. btrfs does not support either recursive snapshots or recursive send so "btrfs send" skips directory entry that points to subvolume root.

#2 lore raw
Quoted 4 lines · Andrei Borzenkov

I think it is expected. btrfs does not support either recursive snapshots or recursive send so "btrfs send" skips directory entry that
points to subvolume root.

Well it's clear that the sub-volume is not contained in the snapshot or sent.

But in the snapshot (on the original fs) I have the empty directory from the subvolume that was not recursively snapshotted. Shouldn't that be just a plain empty directory... and thus be sent|received (as empty directory) when I send|receive the snapshot?

Cheers,
Chris.

#3 lore raw
Quoted 11 lines · Christoph Anton Mitterer
Quoted 4 lines · Andrei Borzenkov

I think it is expected. btrfs does not support either recursive snapshots or recursive send so "btrfs send" skips directory entry that
points to subvolume root.

Well it's clear that the sub-volume is not contained in the snapshot or sent.

But in the snapshot (on the original fs) I have the empty directory from the subvolume that was not recursively snapshotted.

It is not directory. It is "orphan subvolume graft point" for the lack of better term.

tw:/mnt # btrfs subvolume create ./data/pictures Create subvolume './data/pictures'
tw:/mnt # btrfs subvolume snapshot data/ snap1 Create a snapshot of 'data/' in './snap1'
tw:/mnt # ll snap1
total 0
drwxr-xr-x 1 root root 0 Jun 23 07:53 pictures tw:/mnt # touch snap1/pictures/foo
touch: cannot touch 'snap1/pictures/foo': Permission denied tw:/mnt #

Quoted 6 lines

Shouldn't that be just a plain empty directory... and thus be sent|received (as empty directory) when I send|receive the snapshot?

Cheers,
Chris.