Does btrfs have an efficient way to compare snapshots

btrfsdiff()filesystems

While diffing mounted snapshots would work, it sounds like it could be horribly slow in many cases.

Is there btrfs specific functionality for diffing snapshots? (I was unable to find any in the docs)

Best Answer

btrfs send, which appeared in Linux 3.6 (2012), "generates a stream of changes between two subvolume snapshots." You can use it just to produce a fast metadata comparison by adding the --no-data flag.

btrfs send --no-data -p /snapshots/parent /snapshots/child

Normally, you would drop the --no-data flag and pipe the output into btrfs receive, to do incremental backups. For example, if /snapshots/parent already exists at /backup/snapshots/parent, btrfs send would stream only those changes to the /backup filesystem:

btrfs send -p /snapshots/parent /snapshots/child | btrfs receive /backup/snapshots