LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-10-2017, 11:44 PM   #1
asteroid4u
Member
 
Registered: Jun 2015
Posts: 58

Rep: Reputation: Disabled
rsync exclude all nfs mount


Hi,

we are planning take OS backup. OS has nfs mounts as weel.

Currently I am using include and exclude options with rsync but it is lengthy command where i need to include all OS realate like bin, dev, lib, root, etc etc and exclude others with *

Is there any easiest method where i can backup oS with excluding nfs file system and includin all os files.

Thanks
 
Old 07-11-2017, 01:14 PM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,732

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Put your include and exclude patterns in files. From
Code:
man rsync
Code:
            --exclude=PATTERN       exclude files matching PATTERN
            --exclude-from=FILE     read exclude patterns from FILE
            --include=PATTERN       donāt exclude files matching PATTERN
            --include-from=FILE     read include patterns from FILE
 
Old 07-11-2017, 02:18 PM   #3
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
If the OS is entirely in one file system, you can use the -x flag. That restricts rsync to a single file system. So, it would be something like this:

Code:
rsync -vaxAX --delete /. /mnt/nfsshare/myOSbackup/
Even if your OS is stored in a few different file systems, I'd probably go with -x flag, and use multiple rsync commands (one for each relevant filesystem in /etc/fstab).
 
Old 07-11-2017, 02:20 PM   #4
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Oh - if the OS backup is being done over nfs, it's perhaps better to "pull" from the destination server than to "push" from the source server. I find that when rsync tries to write to an nfs mount, some special files have weird permissions that can't be set reliably. But when pulling from an nfs mount to a local hard drive, the weird permissions are set just fine. Either way, though, the resulting backup works fine.
 
1 members found this post helpful.
  


Reply

Tags
linux, rsync



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
exclude folders from rsync alaios Linux - Software 21 10-03-2016 11:09 AM
rsync: exclude / include tux111 Linux - General 4 01-12-2014 01:54 AM
rsync exclude pattern genese Linux - Software 3 12-03-2012 04:26 AM
rsync painfully slow over an nfs mount, between 2 vpn'ed pcs nass Slackware 2 09-21-2007 12:40 PM
can't get rsync exclude files Batta Linux - Newbie 1 03-27-2006 10:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:46 PM.

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