Administrative question: how to _usefully_ compare different datasets

Hello,

i found one sent snapshot of a file system on my backup server. It’s definitely a little bit different and i think i might have forgotten that i left it there to compare it, to make sure it’s safe to throw it into oblivion.

I noticed there is zfs-diff. But it does not really seem to be overly useful when comparing 6TB of user folders, to parse millions of lines to check for deleted or new files, especially since the real information is: even if it has been moved, is it still in?

I looked a little bit and zfs-snapshot-diff might be useful.

What do you use? How do you approach the problem? Can you share some example tidbits? What are your experiences?

Thankyou.

Different compared to the snapshot that was sent or different compared to the live file system? Snapshots are used to replicate since it prevents any kind of live file changes to affect data in flight… I’d be surprised if any data is different from what was originally sent over snapshot.

It only prints the differences. You can output it to a text file to view them later.

If a file was renamed or moved, it will have an R next to it. Unlike file-based tools, it doesn’t matter what folder a file is moved to.

point taken, thankyou. Maybe i didnt consider the command carefully enough.

different to the current live file system living on a different host. Ages in between. There is no more snapshot known between the sent snapshot and the life FS.

indeed, the time is an issue as the response is:

root@TRUENASSMALL[~]# zfs diff -F hdd-pool/bkp_truenas/Tank/Users@auto-2025-05-20_21-34 hdd-pool/bkp_truenas2/Tank/Users > zfsdiffUsers.txt
Not an earlier snapshot from the same fs: invalid name

like i said, the datasets were sent and due to the long time in between, they don’t share a common snapshot

The error says “invalid name”. Is this a different dataset?

If these are two different filesystems, it doesn’t matter where the second one originated from. You won’t be able to use ZFS tools to compare them.

The next best option is to use an rsync dry run with -n to print out the differences.

This is much less efficient and will require crawling the entire filesystem.

I would make a snapshot of the dataset so that rsync doesn’t complain about changes during the operation. It’s also safer because you will not risk deleting anything on the live filesystem.

The command can be something like this:

rsync -n -viahHxx --delete-before /mnt/hdd-pool/bkp_truenas/Tank/Users/.zfs/snapshot/auto-2025-05-20_21-34/ /mnt/hdd-pool/bkp_truenas2/Tank/Users/.zfs/snapshot/compare-2026-07-22_13-30/ > differences.txt

You might have to use sudo if the user does not have sufficient permissions for all the files.

:warning: Make sure you use the -n flag!

:warning: The trailing slashes at the end of the paths are not optional.

Unforunately, since this is file-based, it will treat renames and moves as if the file is missing.

bsdtar also has an mtree mode IIRC. Mtree files can be used in various creative ways. For example, we release / publish mtree of root fs we distribute if you get super-paranoid and want to check hashes on every file in /usr for example to see if anything has been changed out from what we distribute.