btrfs sub snap foo bar
creates an exact same contents of subvolume foo
as subvolume bar
, except the subvolumes in foo
.
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 each folder that is to be excluded. (Con: automatically generated folders can not be excluded as they are created as regular folders, such as
node_modules
in this scenario) - 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?