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?
3 Answers
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.
- 75,182
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.
- 133,878
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".
- 514