1

I was looking for an answer for few hours, but I am still not sure how to compare two Linux Systems with each other. I have an access to them via ssh.

What I was trying: Previously I thought that the best idea of comparing two systems is make an image of those system using dd and then compare them (but I don't know how, yet). Making a copy of the first system took a few minutes, but when i tried to do the same on the second machine - well, I was waiting 24 h and then I killed the process. Sth went wrong.

Command:

ssh -v -i /path/to/key ubuntu@ipAddress "sudo dd if=/dev/sda | gzip -1 -" | pv | sudo dd of=image.gz

(-v was unnecessarily, my mistake) showed me:

debug1: Sending command: sudo dd if=/dev/sda | gzip -1 -

and a day later aftyer kill

 debug1: channel 0: free: client-session, nchannels 1
    64.0KiB 22:03:20 [ 845miB/s] [<=>                                              ]
    debug1: fd 1 clearing O_NONBLOCK
    Killed by signal 2.

Did I something wrong?

Ok, that was the first problem, but the thing is, that I want to compare two systems and I am not even sure if this method is correct. Can I compare two .gz files/images? Any software for that?

7
  • "I want to compare two systems and I am not even sure if this method is correct." sure that is what "diff" is for but ... it will not report differences on the files in the tar file. What do you expect the output to be? A compressed file does not need to compress the same way on 2 systems. You are better off diff'ing the 2 systems.
    – Rinzwind
    Jan 20, 2021 at 20:07
  • I would suggest to use "rsync" with the "dry-run" feature or create a directory tree with files and sizes and use "git".
    – Rinzwind
    Jan 20, 2021 at 20:07
  • 1
    What do you mean by "compare"?
    – FelixJN
    Jan 20, 2021 at 20:15
  • @Rinzwind rsync looks good, I will read more about it - I have never used it. What do I expect the output to be? Well, I think that system files which I could compare (previously I thought thai diff could be helpful) and check if hardware is the same. Those VM are empty, I have to check hardware and compare it, because I want to build the same VM as the second one.
    – newbe
    Jan 20, 2021 at 20:28
  • This is an answer for @Fiximan too, thanks for response guys. I have no knowledge in this kind of tasks. I just try to compare two VM with ssh access only
    – newbe
    Jan 20, 2021 at 20:32

1 Answer 1

1

I assume you do not want a package comparison but an actual difference between 2 systems.

2 options I can think of:

  • You could copy the whole 2nd machine and put it in a directory on the 1st machine. Let's assume /opt/ is empty on your machine you could put /etc/ in /opt/etc/ and do a ...

    diff -ru /etc /opt/etc
    
  • use rsync with the dry-run option from system1:

    rsync -navrc --delete /etc/* {system2}:/etc/
    

    -n (or --dry-run), -v verbose, -r recursive, -a archive mode, -c checksum check (must have: it will report false positives without it). --delete to have it show files not present on system1.

Do this for the normal directories (/var/, /home/, /etc/ etc) and not temporary filesystems like /tmp/, /proc/.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .