Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have two servers, a production server and a cloned image of the production server. There is some difference in the cloned image that is preventing it from working. I'd like to have a list of the differences.

The servers are on different networks so I can't easily compare them. What I need is a something which will create a database of the checksums on the production server and clone server and compare them.

Is there already something that can do this? Or is it easier to write a script to do this?

share|improve this question
1  
What kind of files is it? Config files? If so you some tool to manage same configuration (cfengine, puppet or simple VCS like git...). If data, just rsync, isn't this enough? –  Jiri Xichtkniha May 29 '12 at 9:02
    
Remember that calculating md5 on hole filesystem can last very very long so better use this on concrete directory. –  B14D3 May 29 '12 at 9:05

4 Answers 4

up vote 7 down vote accepted

At each server as root:

find / -type f -exec md5sum {} \; >server-foo.com-files.txt

Then copy those files to your workstation or whatever and

diff -U0 server-foo.com-files.txt otherserver-foo.com-files.txt

That will show you the differences between MD5 sums.

share|improve this answer
    
Don't you need to sort the output (find doesn't necessarily generate the names in a predictable order). –  Paul Cager May 29 '12 at 14:13

I'd go with rsync (which will also update the files if you tell it to):

 [root@local ~]# rsync -avn user@remote:/somedir /somedir
share|improve this answer
    
That's a very incomplete answer. –  John Gardeniers May 29 '12 at 11:01
3  
Compared to the straightforward find/md5sum/diff, using rsync is a really nice idea. –  Oliver May 29 '12 at 11:51
    
Duh, should have thought about this. :-) –  Janne Pikkarainen May 29 '12 at 12:13
    
Incomplete because it misses the -c option which is probably preferrable to normal rsync algorhythms for that purpose. –  rackandboneman May 29 '12 at 14:45

We have a tool that runs diff algorithms between multiple servers. It can also be scheduled to do daily or hourly diffs as a way to watch for unexpected changes. It's in free beta right now, http://metaforsoftware.com, hope it can help you. (Full disclosure: I'm a co-founder)

share|improve this answer
    
Hey, guys don't downv ote this solution just because it is commercial product. I didn't specify a free solution. –  Stuart Woodward May 22 '13 at 5:32
    
thanks @StuartWoodward. We plan to always have a free version available so we can help more people with their diff problems :) –  jyang Jun 8 '13 at 4:58

You can use diff to compare files (you will need to write a simple scipt that will check all files in some directories that you want to check and write output to log file).

Also you can use md5sum to calculate md5s for every file and then find files that differs and use diff on them to find out the differences.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.