How can I test whether deduplication really works?

Simply compare two files with each other.

  1. Both files must have the same inode number.
  2. The link count (second column) should be ≥ 2.

If so, hard linking is working. For example:

ls -li backup1/file.txt backup2/file.txt

The output should look similar to this:

1234567 -rw-r--r-- 2 user user 10485760 Jan 1 12:00 backup1/file.txt
1234567 -rw-r--r-- 2 user user 10485760 Jan 1 12:00 backup2/file.txt

Real world example:

ls -li 2025-12-06/2025-12-06_23-30-12/check_pihole.sh 2025-12-05/2025-12-05_23-30-12/check_pihole.sh
220365 -rwxrwxrwx 33 root root 85 Oct 21 15:00 2025-12-05/2025-12-05_23-30-12/check_pihole.sh
220365 -rwxrwxrwx 33 root root 85 Oct 21 15:00 2025-12-06/2025-12-06_23-30-12/check_pihole.sh

Inode: 220365 – both files have the same inode number → they point to the same content.
Link count: 33 – this means that there are 33 hard links to this content, so this content is only stored physically once.
Size: 85 bytes – the content is small, but no matter how many hard links you create to it, it will not occupy 33×85 bytes, but only 85 bytes once + minimal directory entries.