openSUSE / snapper

Manage filesystem snapshots and allow undo of system modifications
http://snapper.io/
GNU General Public License v2.0
888 stars 125 forks source link

Leveraging cp --reflink #922

Closed averyfreeman closed 1 month ago

averyfreeman commented 1 month ago

Hi, really appreciate you guys maintaining this outstanding software

Curious if snapper is currently capable of creating snapshots via cp --reflink command, and if not, how technically feasible it could be, and if you're open to a PR

Thanks

aschnell commented 1 month ago

AFAIK cp --reflink is not supported by all file systems and cp --reflink still needs a complete run through the file system / directory. This is slow compared to snapshots using btrfs, bcachefs or lvm. A minor problem could also be that since the snapshot is not atomic the snapshot can also have inconsistent content.

What are the use-cases you have in mind? E.g. what file systems.

averyfreeman commented 1 month ago

I was thinking only XFS, because I thought it's the only journaling FS that supports cp --reflink (so far), as perhaps an alternative to thin provisioning.

There is scant resources for snapper + thin-lvm on the web, but I did just set up my first two machines and seem to have good results so far.

Thanks for the background, I wasn't aware there were so many potential stumbling blocks. If the ability to use cp --reflink for snapshots were limited only to XFS, would that change things in your mind?

Edit: Maybe it would make more sense to create a stripped-down fork, e.g. file-snapper, limited only to XFS reflinks and meant only for file recovery (as opposed to system/volume recovery)