I'm copying 1TB of a FreeNAS Server to a USB External Drive, I'm doing it with "cp", and after the copy has finished, I want to compare the files from original files to the copy one.
Is this possible?
I'm copying 1TB of a FreeNAS Server to a USB External Drive, I'm doing it with "cp", and after the copy has finished, I want to compare the files from original files to the copy one.
Is this possible?
You can use diff to compare two file hierarchies:
diff -qr /path0 /path1
Flag -r asks to walk directories recursively, while -q asks to just print a statement when files differ, not the detailed differences. This command prints nothing and exits with status 0 when the the directories are identical.
If you would like a message for each comparison, not just those that fail, use diff -qsr.
On the source drive use find, xargs and md5sum:
find . -type f | xargs md5sum > sums.md5
copy that file to the destination machine (if different) and there do:
md5sum -c sums.md5
The advantage of this is that if you could run the check on the server, which is normally much faster than reading (or comparing), over the network. Not having to have the files "next" to each other means you can (re-) run the check at a later date as well, when the originals might no longer be available.
cp or move with checksum Checksum is stored in the xattr of the file and will be used after the copy to check integrity https://github.com/hansij66/securecopy