I believe the answer is more nuanced than that?
From what I understand, any time a record is read from a dataset, ZFS always confirms its integrity by hashing it against its stored checksum. A tool like "cp" will invoke a
read-and-check operation by ZFS, as will "rsync", as will any application that reads the data into RAM.
However, after this point, it's out of ZFS's hands to verify that the copied file matches the checksum of the original file. This is because you could be "cp'ing" to a different filesystem, or even to a different dataset (in which new records will be written with their own checksums if the recordsize property is different), or even to the same dataset, which once again equally applies (unless using deduplication.)
Since ZFS is not "file-based" (but rather "block-based"), it doesn't verify the
file's integrity against the original: it just verifies the
existing record(s)' integrity when it is
read into RAM. We
assume the "cp'd"
file will be a 100% match to the original file, since if ZFS gives the greenlight that the records read into RAM check out (yay!), and the write operation to the destination filesystem did not hit any I/O errors (whew!), then there's no reason to think that the copied file will have undergone any corruption.
Here's an example of where a "cp" of a file ends up corrupted on the destination:
- File exists on ZFS dataset (checksums of its records are also stored)
- "cp" command is issued to copy the file to another filesystem
- All records of this existing file are read into RAM, ZFS checksums are okay!
- From RAM (all good!) the data of this file is written to the destination filesystem
- The destination filesystem (Ext4, NTFS, XFS) is on a failing device and a few bits are incorrectly written
- ZFS has no way to know about this. It already "did its part".
- If you don't compare the checksums between the two files, you'll be none-the-wiser of "corruption"
When it comes to
snapshots and replications, then ZFS plays its part in
every step of the process, unlike other end-user applications and commands, such as "cp".
I could be way off base and would love to be ridiculed!
* Unlike "cp", when you use "rsync", it confirms that the transferred chunks written to the destination match the checksum of the same chunks read from the source. (This is a "one-time" check to assure the files were written correctly
during transfer and has nothing to do with stored data integrity after-the-fact.) "cp" does no such thing.
So if you want better peace of mind, use "rsync" (rather than "cp") to copy files when feasible.
EDIT: I realized the OP was only concerned with ZFS to ZFS?