[SOLVED] Verifying physical integrity of backed up files
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I bought a new USB drive for primary backups. I used 'rsync -av src dest', and all appears to have copied over.
I want to verify the backup files are actually stored correctly (no on-disk errors), and are exactly the same as the source.
Searches bring up rsync -c or --checksum. But diving into it, this function only works on the sending and receiving processes, not the files after they have been written to disk.
How can I verify the checksums of all my backup files against my source files, post write to disk?
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803
Rep:
Quote:
Originally Posted by SlowCoder
How can I verify the checksums of all my backup files against my source files, post write to disk?
A cheap-n-dirty scriptable post-backup process could be used. You'd need to make a list of the files on the backup drive and obtain their checksums (md5sum or better), sort the result and save the results in a file ("backup.cksums"). Do the same for the source device/filesystem/tree ("source.cksums"). A check for files that are different in the two collections of files would be to issue:
You want the vast majority of the checksums that result from the above steps to be found in pairs (or more which means you have identical copies sitting in different subdirectories). Ideally, there are the same number of files in the source and the backup "trees" and the checksums are identical across the trees so everything in "freq.lis" will be prefixed with "2"---perfect backup! If anything results from the "grep ' 1 '", issue "grep some-checksum" against each of the ".cksums' files to find out what files differed.
Searches bring up rsync -c or --checksum. But diving into it, this function only works on the sending and receiving processes, not the files after they have been written to disk.
I take it your delving didn't include the manpage.
Quote:
Note that rsync always verifies that each transferred file was correctly reconstructed on the receiving
side by checking a whole-file checksum that is generated as the file is transferred, but that automatic
after-the-transfer verification has nothing to do with this option’s before-the-transfer "Does this
file need to be updated?" check.
where src must be the canonical file version. Unless your media is dodgy or you saw errors, your files are good. But go ahead if you want to check.
Quote:
Originally Posted by syg00
I take it your delving didn't include the manpage.
Yes, I did.
To answer both quotes: Apparently this is only an ack with checksum between the sender and receiver protocols, and does not verify the physical write to hardware (hdd, ssd, etc.)
Apparently this is only an ack with checksum between the sender and receiver protocols, and does not verify the physical write to hardware (hdd, ssd, etc.)
Apparently this is only an ack with checksum between the sender and receiver protocols, and does not verify the physical write to hardware (hdd, ssd, etc.)
Assuming that to be true and to mean what you think (I don't know), then the simplest way that comes immediately to mind would be to simply run your rsync command a second time after the initial backup and see if it finds anything different.
@OP: If you use the -c option and run rsync a second time like I told you back in post #2(!) calculating the checksum checks the write. Is there a difficulty with that?
Assuming that to be true and to mean what you think (I don't know), then the simplest way that comes immediately to mind would be to simply run your rsync command a second time after the initial backup and see if it finds anything different.
Quote:
Originally Posted by business_kid
@OP: If you use the -c option and run rsync a second time like I told you back in post #2(!) calculating the checksum checks the write. Is there a difficulty with that?
Now, this does make sense! I would just need to 'sync' the cached data in between to ensure the data has been written.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.