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?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
You can use
diff to compare two file hierarchies:
diff -qr /path0 /path1
-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
On the source drive use
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