PDA

View Full Version : Rsync - command line


vasa1
September 25th, 2011, 11:52 AM
This is what I'm using:
rsync -avrs --modify-window=1 --delete --files-from=/home/vasa1/Desktop/Include / /media/EC82B9BF82B98E98/Testing/ > rsync.log

The --modify-windows=1 is suggested because of time issues when dealing with different file formats. I'm syncing from ext3 to NTFS or FAT32.
(edit: --modify-windows seems relevant to FAT32)
And "Include" is a file containing the list of files/folders I want to sync.

Any comments (not relating to using grsync instead of CLI) will be most appreciated!

linuxforall
September 25th, 2011, 08:16 PM
Have you tried deja dup btw?

vasa1
September 25th, 2011, 11:26 PM
-{ Quote: "Have you tried deja dup btw?" }-

No. I want to learn how to use rsync properly first.

linuxforall
September 26th, 2011, 02:15 AM
-{ Quote: "No. I want to learn how to use rsync properly first." }-


Good move, I am too lazy and use the GUI Deja Dup. :D

tlu
September 26th, 2011, 07:59 AM
-{ Quote: "This is what I'm using:
rsync -avrs --modify-window=1 --delete --files-from=/home/vasa1/Desktop/Include / /media/EC82B9BF82B98E98/Testing/ > rsync.log
The --modify-windows=1 is suggested because of time issues when dealing with different file formats. I'm syncing from ext3 to NTFS or FAT32.
(edit: --modify-windows seems relevant to FAT32)
And "Include" is a file containing the list of files/folders I want to sync.
" }-

Normally, you can skip the -r option as it is already contained in -a. But as you also use --files-from, explicitly adding -r is correct if you want the recursive option.

Regarding -s, man rsync says:
-{ Quote: "This option sends all filenames and most options to the remote rsync without allowing the remote shell to interpret them. This means that spaces are not split in names, and any non-wildcard special characters are not translated (such as ~, $, ;, &, etc.). Wildcards are expanded on the remote host by rsync (instead of the shell doing it)." }-
I'm not sure if you really need it but it shouldn't hurt, either ;)

And --modify-windows=1 makes sense in your case according to man rsync:
-{ Quote: "When comparing two timestamps, rsync treats the timestamps as being equal if they differ by no more than the modify-window value. This is normally 0 (for an exact match), but you may find it useful to set this to a larger value in some situations. In particular, when transferring to or from an MS Windows FAT filesystem (which represents times with a 2-second resolution), --modify-window=1 is useful (allowing times to differ by up to 1 second)." }-

--delete tells rsync to delete any files on the receiving side that aren't on the sending side. This can be problematic. man rsync recommends to use it with the --dry-run option first to see what files are going to be deleted.

vasa1
September 26th, 2011, 08:40 AM
-{ Quote: "...
--delete tells rsync to delete any files on the receiving side that aren't on the sending side. This can be problematic. man rsync recommends to use it with the --dry-run option first to see what files are going to be deleted." }-

Thanks for your comments! I left a bit out!!!

But yes, I do have the -n option and go through rsync.log before doing the real thing...

Just in case someone thinks I figured out stuff myself, I got help here:
http://www.justlinux.com/forum/showpost.php?p=848823&postcount=5 (Parcival's post solving (IMO) Wook's problem)
and papibe's responses to me here
http://ubuntuforums.org/showthread.php?p=11283190#post11283190

vasa1
October 14th, 2011, 11:29 PM
Just in case someone doesn't know this:
ftp://ppp.samba.org/pub/unpacked/rsyncweb/daylight-savings.html

Came across it here:
http://ubuntuforums.org/showpost.php?p=11345356&postcount=13