A way to mount a specific path on an NFS server, based on hostname...

For example:

mount_nfs server:/$(hostname)/usr_local /usr/local

But in /etc/fstab, or some other late mounting file system point in the rc system?

(FYI: Not mounting / via NFS, but usr/local to a specific exported mountpoint).

Not sure how to approach this, any one any ideas please?

Kind regards,
James
 
For example:

mount_nfs server:/$(hostname)/usr_local /usr/local

But in /etc/fstab, or some other late mounting file system point in the rc system?

(FYI: Not mounting / via NFS, but usr/local to a specific exported mountpoint).

Not sure how to approach this, any one any ideas please?

Kind regards,
James
IDK if I understood correctly, but I think what you need is /etc/hosts, take a look at hosts(5).
 
My hosts file is all OK. This is more about how to mount an NFS share, with the NFS path name altered based on a hostname.

I've tried using autofs with the following conf:

/etc/auto_master:
Code:
/usr /etc/auto_usr_local.map

/etc/auto_usr_local.map
Code:
/usr/local -intr,nfsv3 1.2.3.4:/usr/local/somewhere/local/${HOST}

The above works, but I loose the remainder of /usr, e.g.
Code:
service automount start
cd /usr && ls -la
drwxr-xr-x  14 root wheel  14 May 31 11:08 .
drwxr-xr-x  20 root wheel  24 Oct  1 14:32 ..
drwxr-xr-x   2 root wheel   2 May 31 09:32 local

Is there a way for autofs to only mount /usr/local and not have the mountpoint at /usr, but at /usr/local/?

I'm thinking of moving autofs to mount at a clean location and have a soft link to it?
 
You probably need to use a direct map for this kind of setup.
Also not sure if you really need auto-mounting, but that's up to you.
 
Back
Top