0

I'm trying to maintain a replica copy of the File system on another machine for a cold standby.

To to the first copy of the entire system I ran an rsync job with the below command.

rsync -avlP root@master:/data/App1/* /data/app2_testing

This completed successfully without any errors or issue. I was able to start the application as well and was able to use it efficiently.

Ran a second run and that also completed as expected but the only difference being the file system size now in the master was 10 GB but on the Slave machine is 11 GB.

As per rsync it should only copy the modified files but strangely the filesystem size has increased. Went through a few documentation and links still seeing the same behavior:

How to rsync only new files

rsync -hvrPt root@master:/data/App1/* /data/app2_testing

What should be the right procedure to do the rsync so it only copies changed files and not increase the space on the slave machine??

Kusalananda
  • 333,661
  • How did you measure the sizes? Are you syncing sparse files? (In that case, use --sparse with rsync) Are you syncing hard-linked files? (In that case, use -H with rsync) The effect of the -l optin is included in -a, so if you use -a you don't need -l. Why do you use /data/App1/* and not just /data/App1/ as the source? – Kusalananda Apr 21 '21 at 15:46
  • 1
    also, --delete is useful if files are deleted in the source dir and you want them deleted from the destination too. – cas Apr 21 '21 at 15:49
  • Is the drive partition on both computers using the same filesystem (eg, ext4)? Are they both the same size? The files may consume different numbers of inodes, etc, on each if the file systems are not similar. – dave559 Apr 21 '21 at 15:50
  • @cas, the --delete looks to have done the trick. I did that and the delete removed teh files and the space looks almost the same or lesser. Now doing the rest of the testing. – anish anil Apr 21 '21 at 17:10
  • @Kusalananda

    Source

    [root@awsmblx108as002 ~]# df -T /data/ Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/mapper/vgdata-lvdata ext4 2103428672 1161660696 856263476 58% /data

    Destination:

    df -T /data/ Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/mapper/vgdata-lvdata ext4 1388064072 1156443028 170474152 88% /data

    – anish anil Apr 21 '21 at 17:11
  • You may want to add the df output to the question and format it properly. The way it looks now it's not readable. – berndbausch Apr 23 '21 at 01:50

0 Answers0