mwilck / btrfs-clone

A tool for copying a btrfs file system with all its subvolumes to another btrfs file system
GNU General Public License v2.0
116 stars 17 forks source link

limit cloning to a certain directory-tree of the filesystem #5

Open emelin opened 6 years ago

emelin commented 6 years ago

I do appreciate your collection of approaches/algorithms very much!

Wouldn't it be possible to limit the cloning to a certain directory-tree instead of the whole filesystem?

If so, could you hint on where to start modifying your code base?

I guess and hope, this would effect mostly the point of entry; there where the actual subvolume/snapshot hierarchy gets initially collected and sorted.

VTiTux commented 3 years ago

Same request. Would like to have an option to specify the top-level subvolume to clone. I have a storage with several sets of snapshots (backup of different computers). And I want to duplicate only a subset of them (only the nested subvolumes of the specified top-level). This is important, since the destination is smaller than the source. So, I can't duplicate the whole FS.

mwilck commented 11 months ago

I agree that it would be a useful feature, but I don't think it's an easy one. The dependency tree of subvolumes and snapshots can be complex; we'd need to research whether for any given subvolume we can reliably determine whether or not it would be part of the "top-level subvolume".

I can't promise to work on this, but if someone wants to try, patches are welcome.

mwilck commented 11 months ago

Thinking about this some more, I don't consider it very useful any more. The purpose for which btrfs-clone has been written is cloning an entire file system, with all its subvolumes and snapshots, with the result being as close as possible to the original file system.

Cloning just one subvolume is best done with rsync, or perhaps with manual invocation of btrfs send and btrfs receive. I see no relevant real-world use case for running btrfs-clone on a subvolume. At least you would need to show me one for taking this into closer consideration.