From: Rahul on
Our /home dir is mounted via NFS from another server. Whenever I try to run
"locate" to search for a file it doesn't find it. Of course, if I login to
the server where the data physically resides then locate does find the
date.

How can I get locate on the machine to also find the data that resides on
the other machine? Either I've to get locate to connect to the database of
the other machine or I can somehow ask updatedb on the local machine to
also index the remote NFS files. Not sure which is the better approach and
how to do this.

I tried digging around in the manpages but can't figure out how locate
decides what is it's default database. $LOCATE_PATH seems empty.

I do see that in my cron.daily there's a script:

cat mlocate.cron
#!/bin/sh
nodevs=$(< /proc/filesystems awk '$1 == "nodev" { print $2 }')
renice +19 -p $$ >/dev/null 2>&1
/usr/bin/updatedb -f "$nodevs"

But even here I'm not sure where it is storing the default database.

Any tips?

--
Rahul
From: J G Miller on
On Tuesday, 27 July, 2010 at 23:47:44h +0000, Rahul complained:
>
> Our /home dir is mounted via NFS from another server. Whenever I try to
> run "locate" to search for a file it doesn't find it.

Because the contents of /home have not been added to the locate database,
most probably because in the config file for updatedb, which is usually
found at /etc/updatedb.conf, there is an entry with

PRUNEFS=" ... nfs nfs4 ..."
From: Rahul on
J G Miller <miller(a)yoyo.ORG> wrote in news:i2nu47$ec7$5(a)news.eternal-
september.org:

> Because the contents of /home have not been added to the locate database,
> most probably because in the config file for updatedb, which is usually
> found at /etc/updatedb.conf, there is an entry with
>
> PRUNEFS=" ... nfs nfs4 ..."

Thanks for the pointer! Doesn't seem to be the case:

PRUNEFS = "auto afs gfs gfs2 iso9660 sfs udf"
PRUNEPATHS = "/afs /media /net /sfs /tmp /udev /var/spool/cups
/var/spool/squid /var/tmp"



--
Rahul
From: J G Miller on
On Wed, 28 Jul 2010 00:47:06 +0000, Rahul wrote:
>
> Thanks for the pointer! Doesn't seem to be the case:

Why do you say "seem"? If it is not there, it is not there! ;)

Assuming you are using mlocate, then go to

/var/lib/mlocate

and examine the file mlocate.db with view (vi{m} read only).

The file is binary but its format is custom to mlocate so
there are no tools other than locate for looking at its content.

Use the search facility :/\/home\/ to see if there are
any entries for your NFS mounted file system.

If there are no entries present then updatedb has not
examined the contents of the file system, which may be
due to user mapping/permission problems.

If there are entries present, then the problem is you
are using locate as a user with insufficient privileges
to locate the file under /home.
From: Keith Keller on
On 2010-07-27, Rahul <nospam(a)nospam.invalid> wrote:
>
> How can I get locate on the machine to also find the data that resides on
> the other machine? Either I've to get locate to connect to the database of
> the other machine or I can somehow ask updatedb on the local machine to
> also index the remote NFS files. Not sure which is the better approach and
> how to do this.

It depends on how big the NFS server is, and how fast the link between
the client and server is.

If the server is small, and the connection is reasonable, you could in
theory have each client index the NFS share. You'll need to do some
magic to be able to get the updatedb process to be able to see the
entire NFS share, such as using no_root_squash on the server, in order
to build a reasonable locate index on the clients.

If the server is large, or the connection is slow, you will want to
build the database on the server and share it out with your clients. I
did this in the past, but don't recall all the details. I suspect that
the easiest way to do this will be to create a symlink to the share on
the server that has the same name as the mount point on the clients,
then build the database just from that directory (you would not want to
index /usr/bin on the server, for example). Store this database
somewhere under the NFS share; on the clients, you'd use -d to specify
the path to the ''real'' locate database.

> I do see that in my cron.daily there's a script:

You will probably need to tweak and/or make your own script to build
this special locate db. I believe there's a switch to specify where to
put the locate db on running updatedb.

--keith


--
kkeller-usenet(a)wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information