Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

3 Answers 3

up vote 6 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
3  
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
add comment

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
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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