# assuming to drives are mounted at /home/user/primary_storage/ and /home/user/secondary_storage/ respectively,
# the goal is to copy every item on /home/user/primary_storage/ to /home/user/secondary_storage/, then create
# md5 hashes, then compare the results (to ensure the sync was complete and valid
cp -r /home/user/primary_storage/ /home/user/secondary_storage/
cd /home/user/primary_storage/
find . ! -type d -print0 | xargs -0 md5sum >> /home/user/primary_storage/
md5_hashes/md5_primary_`date +"%Y%m%d"`.log
cd /home/user/secondary_storage/
find . ! -type d -print0 | xargs -0 md5sum >> /home/user/secondary_storage/md5_hashes/md5_secondary_`date +"%Y%m%d"`.log
diff /home/user/primary_storage/md5_hashes/md5_primary_`date +"%Y%m%d"`.log /home/user/secondary_storage/md5_hashes/md5_secondary_`date +"%Y%m%d"`.log >> /home/user/error.log