This tool works only if the XFS filesystem is created with the reflink support. For example,
$ mkfs.xfs -b size=4096 -m reflink=1,crc=1 /dev/sdb
curl -L https://github.com/kadalu/reflink-snapshot/releases/latest/download/reflink-snapshot-`uname -m | sed 's|aarch64|arm64|' | sed 's|x86_64|amd64|'` -o reflink-snapshot
install reflink-snapshot /usr/local/bin/
reflink-snapshot create ROOT_DIR PATH@SNAPNAME
Example: File Snapshot
$ reflink-snapshot create /mnt/data photos/2021/my-awesome-photo.jpeg@s1
Snapshot created successfully!
Example: Directory Snapshot
$ reflink-snapshot create /mnt/data photos/2021@s1
Snapshot created successfully!
reflink-snapshot list ROOT_DIR
reflink-snapshot list ROOT_DIR PATH
Example:
$ reflink-snapshot list /mnt/data
photos/2021@s1 (directory)
photos/2021/my-awesome-photo.jpeg@s1 (file)
$
$ reflink-snapshot list /mnt/data photos/2021/my-awesome-photo.jpeg
photos/2021/my-awesome-photo.jpeg@s1 (file)
reflink-snapshot delete ROOT_DIR PATH@SNAP_NAME
$ reflink-snapshot delete /mnt/data photos/2021/my-awesome-photo.jpeg@s1
Snapshot deleted successfully!
reflink-snapshot rollback ROOT_DIR PATH@SNAP_NAME
$ reflink-snapshot rollback /mnt/data photos/2021/my-awesome-photo.jpeg@s1
Snapshot rollback successful!
reflink-snapshot mount ROOT_DIR PATH@SNAP_NAME MOUNTPOINT
Directory Snapshot
$ mkdir /mnt/photos_2021@s1
$ reflink-snapshot mount /mnt/data photos/2021@s1 /mnt/photos_2021@s1
File Snapshot
$ touch /mnt/2021_my-awesome-photo@s1.jpeg
$ reflink-snapshot mount /mnt/data photos/2021/my-awesome-photo.jpeg@s1 /mnt/2021_my-awesome-photo@s1.jpeg