btrfs sub snap foo bar creates an exact same contents of subvolume foo as subvolume bar, except the subvolumes in foo, which are excluded in bar.
What I want is excluding some regular folders too from the output (bar), such as node_modules and tmp; just like rsync --exclude ... does.
There are several ways to make this happen, for example:
- Create a subvolume for the folderseach folder that is to be excluded. (Con: automatically generated folders can not be excluded as they are created as regular folders, such as
node_moduleswithin this approachscenario) - Create a temporary subvolume, delete the unwanted files/folders (Most promising approach), then create the final subvolume from it.
Other than above, can we apply a programmatic filter while creating snapshots?