LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   rsync backup... (https://www.linuxquestions.org/questions/linux-networking-3/rsync-backup-68088/)

tarballed 06-25-2003 08:42 PM

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

moses 06-26-2003 01:25 AM

The man page has a pretty clear list of rules. What are the problems you are having?

tarballed 06-26-2003 11:44 AM

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

fsbooks 06-26-2003 12:03 PM

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.

tarballed 06-26-2003 12:21 PM

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

tarballed 06-26-2003 12:35 PM

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

tarballed 06-26-2003 04:41 PM

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

david_ross 06-26-2003 05:01 PM

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)

tarballed 06-26-2003 05:10 PM

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

fsbooks 06-26-2003 10:00 PM

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.

tarballed 06-27-2003 10:43 AM

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 11:27 PM.