Difference between revisions of "Using rsync"

From vpsget wiki
Jump to: navigation, search
Line 13: Line 13:
 
Example2 .
 
Example2 .
  
This command can be used to synchronize a folder, and also resume copying when it's aborted half way. The command to copy one disk is:
+
This command can be used to synchronize a folder, and also resume copying when it's aborted half way. The command to copy one mnt folder /disk is:
  
  rsync -avxHAXt --progress /mnt/some_disk /usr/bcp/
+
  rsync -avxHAX --progress /mnt/some_disk /usr/bcp/
 +
 
 +
 
 +
Example3:
 +
 
 +
Rsync  folder to remote server with preserving timestamps [for owncloud datadir move for e.g.] ( resume copying when it's aborted half way)
 +
 
 +
rsync -avxHAX --progress 'ssh -p6622'  /mnt/source_folder root@192.168.1.2:/home/traget_folder/
  
 
Command options clarification:
 
Command options clarification:

Revision as of 15:29, 3 June 2020

If you need to copy some data from one vsp to another you can use scp. But if you would like to sync data you can use more powerful tool called rsync. The detailed differ of rsync and scp you can find in the internet.

We will share the example of the usage: Semantic:

rsync -avzH --numeric-ids -e 'ssh -p<ssh_port>' /local/path/somefile.tar.gz <destination_IP>:/remote/path/somefile.tar.gz

Example:

rsync -avzH --numeric-ids -e 'ssh -p6622' /vz/template/cache/centos-6-x86.tar.gz 192.168.1.2:/vz/template/cache/centos-6-x86.tar.gz


Example2 .

This command can be used to synchronize a folder, and also resume copying when it's aborted half way. The command to copy one mnt folder /disk is:

rsync -avxHAX --progress /mnt/some_disk /usr/bcp/


Example3:

Rsync folder to remote server with preserving timestamps [for owncloud datadir move for e.g.] ( resume copying when it's aborted half way)

rsync -avxHAX --progress 'ssh -p6622'  /mnt/source_folder root@192.168.1.2:/home/traget_folder/

Command options clarification:

-a  : all files, with permissions, etc..
-v  : verbose, mention files
-x  : stay on one file system
-H  : preserve hard links (not included with -a)
-A  : preserve ACLs/permissions (not included with -a)
-X  : preserve extended attributes (not included with -a)
-t  : preserve modification times