1

We copy our production code and data files to a testing server on a weekly basis. It can take hours, and sometimes it hasn't finished.

What is the best method to confirm that the directories have been copied correctly from one server to another?

  • I was hoping that dircmp could be used, but I don't see how it can be used between servers.
  • My second option is to map (link) one of the directories to the other server, and then use dircmp on them.
2

Write a list of the md5sums of the files in the directory in some specific order to a file, with, say, one md5sum per line, on both machines. Take the md5sum of that file. If the md5sums are the same, the directories are the same.

2

Can you do the comparison online? If so, use rsync or unison. Once they've finished running, the directories are identical. If you just want to test without changing anything, run rsync -vn and check that no file would be copied.

If you have no network connectivity, compute a checksum of all the files on both sides and compare that, as suggested by Faheem.

In fact, if you need to ask this question, there's probably something wrong with your setup. Whatever tool you're using to perform the copy should be telling you if everything was copied properly, by returning 0. If the copying tool returns nonzero or has not completed (yet), assume you don't have a complete copy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.