im doing regular search in files contents in around 25 linux file systems (mostly redhat, debian).,
i want to lower load on server by excluding folders which contains only system files and alot of files
Which linux folders contains most files?
I found i can exclude folders like this:
[QUOTE]find . -type f -name “searched phrasse” ! -path “./tmp/" ! -path "./var/log/”
the linux will entirelly skip above excluded directories, or it will go into them and search, but only mute listing? thx
i mainly want to relieve disk I/O operations, thats also why i added "/bin/nice -n 19 " before the find command
when did: du -h /usr --max-depth=1
239M /usr/lib64 - 2 minutes to appear!
232M /usr/local - 2 minutes to appear!
685M /usr/share - 5 minutes to appear
218M /usr/lib - 2 minutes to appear!
more about linux /usr
I didn’t think nice affected I/O at all, I thought it was a CPU priority setting…
I guess that might have a knock-on effect on the I/O scheduling, but won’t be the same in an I/O bound operation
On my system, I think my /home folder has the most files, thanks to Steam. I’d guess on a server, not including any storage folders (like /home), I’d suggest that /usr would have the most, maybe /usr/bin to be more specific. Be aware, that different distros use different folder structures, so the answer will differ depending on distro.
What you’re doing is a pretty broad search, especially searching for text strings in binary files (which many of the libraries and system files will be). You might be better off searching specific folders that are known to contain text like those in /home, /etc & /usr/doc, before ploughing through the whole drive
I thought “-prune” was to stop ‘find’ descending into a directory ?
(but as usual, probably more than one way to skin a cat)
wouldn’t ‘ionice’ be a better choice than ‘nice’ to prioritise I/O scheduling for your ‘find’ command ?