Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-14-2008, 10:39 AM   #1
Registered: Nov 2003
Posts: 785

Rep: Reputation: 39
How to exclude specific directories from an rsync backup

Hi there --

I am running rsync and I want to exclude several directories from the backup. The directories in question are the following:


The directories in question are all NFS mounts. What is the correct syntax to use so that while the /usr directory on the local system is backed up, the NFS directories shown above are not included in it? Thanks.
Old 05-14-2008, 11:51 AM   #2
ReliaFree Maintainer
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,812
Blog Entries: 1

Rep: Reputation: 259Reputation: 259Reputation: 259
Take a look at the rsync manpage for the --filter, --exclude, and --exclude-from options.
Old 05-16-2008, 12:09 PM   #3
Registered: Nov 2003
Posts: 785

Original Poster
Rep: Reputation: 39
Hi there --

Thanks for your reply. I tried several different syntaxes which are shown below:

rsync --exclude -lq /usr/tools --exclude -lq /usr/maui --exclude -lq /usr/oahu -e ssh -alrvz / <remote ip>:/<directory>
rsync --exclude -lq /usr/tools/* --exclude -lq /usr/maui/* --exclude -lq /usr/oahu/* -e ssh -alrvz / <remote ip>:/<directory>
Both instances resulted in a list of files and directories that could not be backed up due to permissions issues. Here is a sample of the output that I am seeing:

rsync: opendir "/usr/maui/cjr3/.dt/Desktop" failed: Permission denied (13)
rsync: opendir "/usr/maui/cjr3/.hh" failed: Permission denied (13)
rsync: opendir "/usr/maui/cjr3/.netscape" failed: Permission denied (13)
rsync: opendir "/usr/maui/dag26/.dt/Desktop" failed: Permission denied (13)
rsync: opendir "/usr/maui/dal19/.dt/Desktop" failed: Permission denied (13)
rsync: opendir "/usr/maui/dal19/.hh" failed: Permission denied (13)
rsync: opendir "/usr/maui/dal19/.kde/share/config" failed: Permission denied (13)
The files shown in the error output were located in those directories that were supposed to be excluded from the rsync backup. My syntax is wrong, but I am not sure what the correct version is to use.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
help with rsync exclude syntax please JacekZ Linux - General 2 07-08-2007 01:23 PM
What files to exclude when using rsync TongueTied Linux - General 2 07-20-2006 08:39 PM
can't get rsync exclude files Batta Linux - Newbie 1 03-27-2006 10:39 PM
rsync exclude list steelhead79 Linux - Software 3 01-14-2005 12:10 PM
how to rsync ex/include select specific directories ? dtimms Linux - Software 1 01-11-2005 05:16 AM

All times are GMT -5. The time now is 04:16 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration