Bug 208789 - nested subvolume results in empty folder when making snapshot of parent
Summary: nested subvolume results in empty folder when making snapshot of parent
Status: NEW
Alias: None
Product: File System
Classification: Unclassified
Component: btrfs (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: BTRFS virtual assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-03 16:25 UTC by Stuart Smith
Modified: 2020-08-11 06:26 UTC (History)
1 user (show)

See Also:
Kernel Version: 5.3, 5.4, 5.6
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Stuart Smith 2020-08-03 16:25:10 UTC
Issue: When taking a snapshot of a subvolume that contains a nested subvolume, the nested subvolume appears in the snapshot as a folder but contains no contents. This is troublesome because;

1. It may lead a user to falsely believe that the contents of the nested subvolume are included in the snapshot of the parent.

2. It requires manual deletion of the bread-crumb folder before restoration of the file system can be completed successfully.

Steps to replicate:
1. Mount a parent subvolume.
2. Create a nested subvolume within the parent.
3. Add content to nested subvolume and observe content.
4. Make a snapshot of parent subvolume.
5. Observe snapshot contains a folder the same name as the nested subvolume and it is empty.

Systems tested on:
KDEneon User Edition up-to-date, kernel 5.4.0-42-generic
KDE Neon Unstable 520200510-1103, kernel 5.3.0-51-generic
Manjaro KDE 20.0.3, kernel 5.6.15-1-MANJARO

Why a user might want to use nested subvolumes:
Allows use of subvolumes without requiring multiple mounts and transparent to users.

Preferred behavior: Snapshots of a subvolume should not include folders of nested subvolumes.
Comment 1 David Sterba 2020-08-11 06:26:13 UTC
This is known and documented. Snapshots are not recursive but have to represent the original subvolume completely, including any other nested subvolume. For that there's the placeholder, with specific inode number 2. It can be deleted by rmdir.

If you need to recreate original subvolume layout from a snapshot, the empty subvolumes need to be replaced by proper subvolumes. As this requires some steps, this is managed by tools like snapper.

The documentation about that is mainly on the wiki, I haven't seen this explicitli mentioned in the manual page, so this could be improved.

Note You need to log in before you can comment on or make changes to this bug.