On 3/2/26 5:24 AM, Samuraiii wrote:
On Mon, 2026-03-02 at 12:07 +0100, Philipp Ludwig wrote:
Am 2026-03-02 11:53, schrieb Dale:
Howdy,

I did my weekly backups overnight.  I had a lot of new files.  I
was
wondering tho, can I generate a checksum or something for the
directory on my main rig and then generate it for my backup copy
and
then compare the two checksum results?
You can use `find` to generate a checksum for every file:

find /path/to/dir -type f -exec md5sum {} \; > output.md5

Then, you transfer the output file to the new machine and run md5sum
-c:

md5sum --check < output.md5

Beware that the path needs to match. So you may need to adjust the
first parameter of `find` or play around with `sed` a bit.

For example, I use this to verify the backup of my ~ folder. First,
I go to /home/philipp and run

    find home/philipp/ -type f -exec md5sum {} \; > /tmp/home.md5

Then, I go to the folder where I did the test restore, and verify:

    $ cd /mnt/data/backup-test-restore
    $ ls
    home
    $ cd home
    $ md5sum -c /tmp/home.md5

And for a quick user check (OK or not-OK), you can checksum the file
with checksums and compare its checksum on the other side.
Just do not forget that find does not sot the data in any user useful
way.
So I suggest sorting the checksum file first:
find home/philipp/ -type f -exec md5sum {} \; | sort> /tmp/home.md5
md5sum  /tmp/home.md5

S.
While at it, how long would it take to do a directory that is about
42TBs in size?  If it would take a long time to do it that way, is
there a faster way to make sure the files match in a fairly quick
way?
It depends on the checksum algorithm. In the example above I used
md5,
which is considered deprecated, but fairly fast. Other examples would
be
sha256sum, sha512sum, etc.

Also, I use rsync to copy the files to the NAS box.  Maybe it can
do
some sort of check while copying the files over???
rsync has a --checksum flag for this.
Also, you may want to look at rclone, which is a bit more
sophisticated
for
use cases like this:

https://rclone.org/commands/rclone_sync/

HTH


I was hoping I could do a whole directory not each individual file. It looks like this can't be done which may be why my searches lead nowhere.  The method you two posted is similar to what I found but it's way to complicated for me.  My command line skills isn't very good.

I checked the rsync man page, I can't find a option for checking a file when it is being copied over.  I found a mention of checksum that lets you tell it what checksum tool to use but can't find the option where I tell it to do the check.  Does it have a weird name that isn't obvious as to what it does??

Thanks to you both.

Dale

:-)  :-)

Reply via email to