Erik Jakobsen wrote:
Anton Aylward wrote:
Erik Jakobsen said the following on 01/08/2009 11:11 AM:
Many thanks for the replies to my query. Not that I understand much of it, but I will study the man page, and hope I get more insight.
Isn't there an O'reilly book or page on it?
Did you see any ?. I think your reply is as good as "I have a problem,
David C. Rankin wrote: pleas help me". Can that be used to anything ?
No book needed.
In konqueror just enter #rsync or from the cli, just do rsync --help or man rsync. The man page is really quite good.
Ok David and thanks for your reply. I will try to follow your example. That what you wrote here is a real help.
Erik, You will love rsync. Seriously. If I want to backup a set of files/directories, I do one of two things. If the list is small, I just right a small script with individual rsync calls. For example to backup my ~/.kde, ~/tmp and ~/linux/boxes directories to a usb stick that mounts as /media/KINGSTON, I would simply create a 'david' and 'david/linux' directory under /media/KINGSTON and write a 3 line script: #!/bin/bash rsync -auv ~/.kde /media/KINGSTON/david rsync -auv ~/tmp /media/KINGSTON/david rsync -auv ~/linux/boxes /media/KINGSTON/david/linux I would probably add to that a test to make sure KINGSTON was mounted to keep from filling up /media with my stuff: #!/bin/bash if mount | grep --quiet KINGSTON; then rsync -auv ~/.kde /media/KINGSTON/david rsync -auv ~/tmp /media/KINGSTON/david rsync -auv ~/linux/boxes /media/KINGSTON/david/linux else echo -e "\nKINGSTON isn't mounted -- try again\n" fi There are really only 2 things you need to remember about rsync to not get messed up: (1) a trailing slash on the source files means copy everything in the directory, no trailing slash means copy the directory itself along with the contents; example: rsync ~/.kde/ /media/KINGSTON means dump everything under the .kde directory in /media/KINGSTON, while: rsync ~/.kde /media/KINGSTON means copy the .kde directory itself to /media/KINGSTON/.kde and (2) if you do use the --files-from option, you must remember to explicitly give the -r option to make rsync copy recursively. Other than that it is just picking the options from rsync --help you want to use. Oh, and rule (3), the -n option is your friend! If I have a long list of files I want to copy, then I use --files-from to specify the text file to read the list of files to copy from. Let's say I wanted to backup parts of my linux directory to /media/KINGSTON/linux-save. The parts I want to backup are: gpg GPGQuickStart gpg-Quickstart.html gpl-2.0.txt HOWTO-encryptRootSwapHome.pdf icewm.mail.setting images iqcnumber irc kde kernel ldap linux_lBM-harden-desktop.pdf madwifi mail mount mozilla mysql network_IBM-Build_Linux_test_Network.pdf notes nut nvidia openoffice openSuSE I would create a text file containing the above list of files and directories and then just use 1 rsync command to backup everything at once. Create the /media/KINGSTON/linux-save directory. Then if I saved the above list in the file 'bkupfiles', then I can use rsync as follows: rsync -auvr --files-from=bkupfiles ~/linux /media/KINGSTON/linux-save (remembering rule 2. above) Which basically says rsync all the files-from bkupfiles beginning with the base directory of ~/linux and recursively copy all files and directories listed from ~/linux/<read from file> to the backup location of /media/KINGSTON/linux-save while preserving user, group, file creation time, special files and links. Another great rsync option for backup is the --delete option that will get rid of files on the backup set if they have been deleted from the source files. All in all, rsync is pretty simple. For remote backups, see the -e ssh option. Once you play with rsync for a while and see what it can do, you will wonder how you ever got along without it. Another great benefit of using a script to call rsync is that once you have it working the way you want, just throw it into a cron job to run a 0400 and forget about it. It will do the work for you while you sleep ;-) Seriously, looking at rsync --help, the only options I really ever use are: Options -v, --verbose increase verbosity -q, --quiet suppress non-error messages -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X) -r, --recursive recurse into directories -R, --relative use relative path names -u, --update skip files that are newer on the receiver -l, --links copy symlinks as symlinks -p, --perms preserve permissions -o, --owner preserve owner (super-user only) -g, --group preserve group -t, --times preserve times -n, --dry-run show what would have been transferred ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -e, --rsh=COMMAND specify the remote shell to use --delete delete extraneous files from destination dirs --numeric-ids don't map uid/gid values by user/group name --exclude=PATTERN exclude files matching PATTERN --files-from=FILE read list of source-file names from FILE --port=PORT specify double-colon alternate port number --progress show progress during transfer (-h) --help show this help (-h works with no other options) -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org