1

Use case - Compare all the files and directories on the mounts ( /apps , /logs , etc ) and calculate which one is the latest and size differences.

I am trying with rsync command , but with the limitation I am not achieving exactly what I need.

Under /tmp/test_ram I created two directories as dir1 and dir2. I have created two files under dir1 as shown below .

drwxr-xr-x 2 chada users 4096 Nov 21 12:03 dir2
drwxr-xr-x 2 chada users 4096 Nov 21 12:03 dir1

cd dir1 ; ls -ltr
total 196
-rw-r--r-- 1 chada users 188510 Nov 21 12:03 file_man_rsync
-rw-r--r-- 1 chada users   6854 Nov 21 12:04 file_man_diff

With DryRun –

I see nothing is happening which is expected, but in the o/p size is showing as zero. Which is not I was expecting, I want to see a size in diff of files

rsync -n -avrczP --out-format="%t %f %''b" --backup --backup-dir=/tmp/test_ram /tmp/test_ram/dir1/ /tmp/test_ram/dir2/


sending incremental file list
2018/11/21 12:04:55 tmp/test_ram/dir1/. 0
2018/11/21 12:04:55 tmp/test_ram/dir1/file_man_diff 0
2018/11/21 12:04:55 tmp/test_ram/dir1/file_man_rsync 0

sent 161 bytes  received 25 bytes  372.00 bytes/sec
total size is 195,364  speedup is 1,050.34 (DRY RUN)

the actual run :

I see the file size is showing up, which is what expected. But I cannot take chance in copying without checking. Yes I do have backup dir, but still it need too much of analysis .

rsync -avrczP --out-format="%t %f %''b" --backup --backup-dir=/tmp/test_ram/dir3 /tmp/test_ram/dir1/ /tmp/test_ram/dir2/


2018/11/21 12:05:52 tmp/test_ram/dir1/. 0
file_man_diff
          6,854 100%    0.00kB/s    0:00:00 (xfr#1, to-chk=1/3)
2018/11/21 12:05:52 tmp/test_ram/dir1/file_man_diff 2.48K
file_man_rsync
        188,510 100%   16.34MB/s    0:00:00 (xfr#2, to-chk=0/3)
2018/11/21 12:05:52 tmp/test_ram/dir1/file_man_rsync 56.28K

sent 58,915 bytes  received 57 bytes  117,944.00 bytes/sec
total size is 195,364  speedup is 3.31

This is an example I took to depict . But my comparision would be between multiple servers.

The mount points can be same , but the files are directories is what I needed to compare.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.