Solved

exclude NFS & EFS from find command searches.

Posted on 2013-02-01
9
1,008 Views
Last Modified: 2013-02-10
Am trying to overcome a stumbling block when using the find command. It may actually be simple but I'm not thinking clearly. If I use find -fstype nfs, it list NFS and/or EFS mount points. However, what I want to do is the  exclude NFS & EFS mount points when search starting at / (root) so I can get a faster search result. Does someone have a quick fix?
0
Comment
Question by:teckwiz01
  • 5
  • 4
9 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 38845551
-xdev
(some older versions use -local)
0
 

Author Comment

by:teckwiz01
ID: 38847538
Can you give me an example of how to use that option? I've never used it before, didn't even know about it. I looked up man pages and some online stuff, but I'm still not clear on the syntax.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 38848395
find / -xdev -name funny-file
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

Author Comment

by:teckwiz01
ID: 38861509
If there are multiple mount points, do can you just list them one after the other, do you need to use -xdev each time, or is it limited to just one mount point?
0
 

Author Comment

by:teckwiz01
ID: 38861551
Also, I'm getting this when I try a simple repeat of what you suggested.

# find / -xdev -name /nfs/sharedstuff
find: warning: Unix filenames usually don't contain slashes (though pathnames do).  That means that '-name /nfs/sharedstuff' will probably evaluate to false all the time on this system.  You might find the '-wholename' test more useful, or perhaps '-samefile'.  Alternatively, if you are using GNU grep, you could use 'find ... -print0 | grep -FzZ /nfs/sharedstuff'.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 38863350
hmm, I'm a bit confused according your example
  /nfs suggest to me that your searching nfs mounted file system, then -xdev does not make much sense

also -name expects a filename, not a pathname
0
 

Author Comment

by:teckwiz01
ID: 38872491
Ok, I think I may have misunderstood the example given and used it the wrong way. I am definetly trying to exclude searching inside the nfs mount point. For example, lets say I want to search for apache on a bunch of machines. Apache has a default install location, but some install it in different placed for security reasons. So if I was searching for apache starting at root (/), having a remote mount point would cost me alot of time waiting for it to finish searching, so I want to exclude anything that is not part of the local system.
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 100 total points
ID: 38872545
# repeating myself:
find / -xdev -name funny-file
0
 

Author Comment

by:teckwiz01
ID: 38873319
OK ahoffmann. If you actually read my response, I said I misunderstood the example. I get it now. I thought you were saying to include the filesystem I'm trying to exclude. xdev doesn't decend into other filesystems. Sorry.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
capture pcap with filtered traffic 1 60
aix unix tar error 3 65
Near realtime alert if SQL Server services stop. 20 71
Help on running oracle SQL script in linux 3 48
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question