0

I am running a script to rsync a folder from client to server.

Syntax applied on the script is

rsync -avzP --append-verify --delete -e "SSH parameters" source_dir user@host:destination

But when the rsync is interrupted due to network issues, the source file gets corrupted when the rsync restarts.

Example: Source file before transfer.

root@localhost:~# ls -Alth
total 1.1G
-rw-r--r--    1 root root    1.0G Nov 12 08:56 testfile1GB

Source file after the transfer was interrupted and then restarted.

root@localhost:~# ls -Alth
total 152M
rw-------    1 root root    152M Nov 15 17:46 testfile1GB

Currently used rsync version 3.1.1 protocol version 31.

Please note rsync version cannot be updated.

Let me know if there is any suggestions.

0

1 Answer 1

0

Unless you use the --remove-source-files, the rsync will never change anything in the source (and even then, it will only remove the source files when it has confirmed that the destination has an accurate copy). Therefore, the changes you're writing to your destination must be affecting the source in some other way.

Please double-check that with user@host:destination: you are not accidentally overwriting your source file. In other words, make sure that host isn't your client, and also that host is not sharing the same filesystem as your client (e.g. with NFS or Samba). You can verify this as follows:

Local system, in the same directory as your example, replacing source_dir as appropriate

touch source_dir/620014.tmp
ls -ld source_dir/620014.tmp

Remote system, replacing source_dir and destination as appropriate. (If your rsync command actually has source_dir/ rather than source_dir then the command must not include source_dir in its path.)

ssh -nq user@host ls -ld destination/source_dir/620014.tmp

If you get the same file then the two systems are sharing the same filesystem and your rsync is neither necessary nor appropriate.

3
  • The source and destination are different, reason why the source and destination hostname/IPs are not provided because of security reasons. Commented Nov 17, 2020 at 11:30
  • Don't worry, I don't need to know the host names or IP addresses. If they are different then either they are sharing the same filesystem or a completely coincidental corruption occurred. The rsync tool will never change the source Commented Nov 17, 2020 at 11:55
  • Thanks, let me check further into. Commented Nov 17, 2020 at 12:02

You must log in to answer this question.

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