Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
06-25-2003, 08:42 PM
|
#1
|
Member
Registered: Jun 2002
Distribution: RH, FC, FreeBSD,OpenBSD
Posts: 326
Rep:
|
rsync backup...
Rsync question here...
I was curious if anyone knew how to setup a rsync job that would only backup certain directories within a certain partition?
For instance, I have a partition on my linux server that has about 15 directories in out. I want to run a rsync backup job that will only backup certain directories on it...
I know this can be done using include/exclude, but im having a little trouble figuring it out...
Anyone have any suggestions?
Thanks.
Tarballed
|
|
|
06-26-2003, 01:25 AM
|
#2
|
Senior Member
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152
Rep:
|
The man page has a pretty clear list of rules. What are the problems you are having?
|
|
|
06-26-2003, 11:44 AM
|
#3
|
Member
Registered: Jun 2002
Distribution: RH, FC, FreeBSD,OpenBSD
Posts: 326
Original Poster
Rep:
|
Well, what Im trying to do is have rsync backup selected directories and ignore the other directories.
I was flipping through the rsync man page, but was having a hard time figuring out just how to specify certain directories.
Any ideas?
Tarballed
|
|
|
06-26-2003, 12:03 PM
|
#4
|
Member
Registered: Jan 2002
Location: Missoula. Montana, USA
Distribution: Slackware (various)
Posts: 464
Rep:
|
How about specifying them in a file and using, as you say "exclude".
From the man page:
--exclude-from=FILE exclude patterns listed in FILE
Try a small directory as a test, excluding a subdirectory. Just the the directory in the file to "specify" it. If that does not work, repost what you tried, what you expected, and what you got.
|
|
|
06-26-2003, 12:21 PM
|
#5
|
Member
Registered: Jun 2002
Distribution: RH, FC, FreeBSD,OpenBSD
Posts: 326
Original Poster
Rep:
|
Ok, here is what I am attempting to do:
rsync -rv --include-from=/root/rysncfile /backupstorage/D/ /backupstorage/rsync
Here are the contents of the rsyncfile:
/backupstorage/D/CLOSED/
/backupstorage/D/declines/
/backupstorage/D/LEADS/
/backupstorage/D/"My Documents"/
/backupstorage/D/PERSONAL/
/backupstorage/D/PNTDATA/
/backupstorage/D/PNTTEMPL/
/backupstorage/D/PRIVATE/
/backupstorage/D/TDS03/
I thought I would go with includes to specify the directories specifically.
Any thoughts or input? Im running a "dry run" as I write this.
Tarballed
|
|
|
06-26-2003, 12:35 PM
|
#6
|
Member
Registered: Jun 2002
Distribution: RH, FC, FreeBSD,OpenBSD
Posts: 326
Original Poster
Rep:
|
Ok, im doing something wrong. I tried specifying a file for includes and excludes and it still is backing up the entire directory.
I must be specifying it incorrectly in the file.
It still backups up the entire /backupstorage/D.
ANy ideas?
Tarballed
|
|
|
06-26-2003, 04:41 PM
|
#7
|
Member
Registered: Jun 2002
Distribution: RH, FC, FreeBSD,OpenBSD
Posts: 326
Original Poster
Rep:
|
Ok. This where im at.
If I specify my excludes at the command line, it works correctly.
However, I cannot seem to get it to work correctly if I put it into a file.
I used the following command:
rsync -av --exclude-from=exclude.conf /backupstorage/D/ /backupstorage/rsyncbackup
It's running a backup off the local machine, so its just copying data from one location to another, but doing incremental...
Any ideas?
Tarballed
|
|
|
06-26-2003, 05:01 PM
|
#8
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
If you add another "v" to increase the verbosity you will see if the exclude file list is loaded (near the start of the output)
|
|
|
06-26-2003, 05:10 PM
|
#9
|
Member
Registered: Jun 2002
Distribution: RH, FC, FreeBSD,OpenBSD
Posts: 326
Original Poster
Rep:
|
Alright. I figured it out.
After doing reading and testing, this is what I found.
Obviously, include is set by default. So it will automatically grab everything.
What I did was create a script and put all the direcotires I wanted not to be backed up in there. I also had the incorrect syntax in the file...instead of the full path, it should be:
/<FOLDER/
I had the full path which was messing it up.
Tarballed
|
|
|
06-26-2003, 10:00 PM
|
#10
|
Member
Registered: Jan 2002
Location: Missoula. Montana, USA
Distribution: Slackware (various)
Posts: 464
Rep:
|
Glad you got it licked :-) Sometimes the man pages only make sense after one knows the information they provide. For example, as you discovered about the behaviour of include is stated succinctly in the manpages thus:
--include=PATTERN donīt exclude files matching PATTERN
--include-from=FILE donīt exclude patterns listed in FILE
So an include works only to negate an exclude. The EXCLUDE OPTIONS section is interesting: one can build some quite complicated formulas for backup/copying. You have inspired me to try some things out, thanx.
|
|
|
06-27-2003, 10:43 AM
|
#11
|
Member
Registered: Jun 2002
Distribution: RH, FC, FreeBSD,OpenBSD
Posts: 326
Original Poster
Rep:
|
Ya, rsync is very very cool. I am planning on using it more on my network here. I feel it has a lot of potential.
For now, im going to backup those directories on my server, and then use SSH to put them on another server to safety sake...
When im done, I will put the full script and setup here on this page.
Tarballed
|
|
|
All times are GMT -5. The time now is 12:05 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|