Sunday, May 26, 2013

rsync notes


rsync
  commands to execute rsync is

Points to be careful with when using Rsync?
  • Be careful with the --delete command. If your using a source dir that is not mounted (nfs,cifs,etc) but the mount for the dir is still there then you will sync your blank dir. All remote files will be deleted.
  • Be careful with slashes after the dir names on the source. A slash after the dir name compared to no slash after the dir name will do 2 totally different things.
Difference in giving "/"
What if we  wanted to not just copy all of the files under /sourcedisk/, but also the /sourcedisk/ directory name. Just leave off the last "/" after the "/sourcedisk" directory name. This will tell rsync to copy the directory name and all files under that directory. On the remote server you will then see the directory structure /backups/sourcedisk/.

To reflect the deleted files to be removed from the destination


-r => recurse into directories
-a => archive
-v => increase verbosity
-z => compress file during transfer


this will copy the "Project" Folder entirely to remote server /home/joseph



This will copy the contents of "Project" to the remote server /home/joseph. ie you will not have folder "Project" in remote server, but you will see the contents of it in /home/joseph/

No comments: