SoFunction
Updated on 2025-03-02

How to implement breakpoint continuous transmission

rsync implements breakpoint continuous transmission

The rsync command has two advantages over the scp command

Support breakpoint continuous transmission

When copying folders repeatedly, you can copy only modified files, greatly improving efficiency

When transferring larger files, we can consider using the rsync command for data transmission.

Example:

rsync -avP /home/ [email protected]:/etc/libvirt/qemu/
  • -a Archive mode
  • -v Detailed output
  • -P Show progress
  • The –partial parameter can implement breakpoint continuous transmission, use example:
rsync -avP --partial /home/ [email protected]:/etc/libvirt/qemu/

Replenish

-r Recursion

Example:

rsync -avPr --partial /home/l [email protected]:/etc/libvirt/qemu/
–exclude=‘.git' This parameter is also very useful,The function is to exclude files that match patterns
-e ssh usesshAs a remoteshell
-a, --archive // Archive-q, --quiet //Silent mode-p, --perms //Keep the original permission attribute-z, --compress //Compress during transmission, save bandwidth and speed up transmission speed–delete //Deletion operations performed on the source server will also be synchronized on the target server

rsync to transfer files (can be transferred to interrupt points)

If there is an error in scp file transmission, you have to do it again. Rsync can implement the function of breakpoint uploading.

Probably this is how it is used

rsync -P --rsh=ssh  192.168.205.34:/home/

The transferred files will be hidden and viewed with ls -a.

If there is an error in the middle, just run the same command and upload it again.

Summarize

The above is personal experience. I hope you can give you a reference and I hope you can support me more.