Diff on remote servers file systems

Iam trying to compare two file systems on two hosts basically to check them to be in sync

I dont have rsync so trying to use diff

Let me know how to do it....

Thanks

generate a listing of each filesytem (find -xdev <file-system> -exec ls or something), sort and diff them...try putting something together.

rsync would really help you with this, but I suppose if you wanted to do a diff, you could run the command

$ diff -rupN <filesystem1> <filesystem2>

which you could create a patch from the diff output, and you could "patch" filesystem1, to make them sync. hope this helps.

Here's a really crude thing I threw together just now that worked for me. Some variation on this, which just gets a list of files and checksums with "ssh", might help.

#!/bin/bash

for hh in HOST1 HOST2
do
    ssh $hh 'cd PATH-TO-DIRECTORY || exit; find . -type f -print | while read path; do echo "$path $(sum $path)"; done'
done \
| sort \
| uniq -c \
| gawk '\

    { fr[$2] = $1; }

    END \
    {
    for( path in fr )
      if(fr[path] == 2) printf "Same %s\n", path
      else printf "Diff %s\n", path
    }'

Replace HOST1 and HOST2 with hostnames that will work on an "ssh" command. Meaning, short names if that works or fully qualified domain names. It just needs to get you to the server the script doesn't use that info afterwards.

And replace PATH-TO-DIRECTORY with the top of the directory tree you want to compare.

I tried just doing "-exec sum {} \;" in the "find" but it doesn't print the filename on the systems I'm using. That's why there's a shell script consuming the output from find and running "sum".