Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using an ubuntu server and the project I am working on has very strict requirements regarding making sure data is not corrupted. I can't seem to find a good answer on this, when doing a local copy of files to a new directory, is it necessary to do an Md5sum, or does the operating system do this sort of check by default to make sure the file transfer goes through properly?

share|improve this question
up vote 7 down vote accepted

Neither cp nor any of the common (or uncommon) desktop environment's file managers will check md5 sums after they copy. You will need to do that yourself. Depending on the type of file manager you use, or through the use of scripts, you could automate the check.

Also be aware that sha1 is a strong algorithm than md5 if you are looking to do more than just "checksum" the copy.

share|improve this answer
thanks for the info, interesting about sha1, but the Project manager wants md5 so I don't care to bother trying to change his mind :) – Rick May 18 '11 at 0:03
MD5 is enough; you don't need it to be cryptographically secure since bit errors will result in a different hash. – Ignacio Vazquez-Abrams May 18 '11 at 0:13

well, you could probably use rsync locally to do that - it has its own rolling checksum algorithm and it'd be more painless than checksumming each and every file.

share|improve this answer
I'm going to be doing it from or Java app so its not a big deal to code it up to do the check automatically – Rick May 18 '11 at 0:08

One option that might be easier than using md5sum in file copying is to use rsync with the -c option. rsync is a capable file copying and backup command. For example, to copy the contents of /src/foo to /dest/foo:

rsync -acv /src/foo/ /dest/foo

Note the idiosyncratic use of the trailing slash in the first parameter.

See the man page for rsync for more details.

Edit: -c is for "checksumming".

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .