1831382 Members
3162 Online
110025 Solutions
New Discussion

NFS Mount

 
SOLVED
Go to solution
Cliff Lim Kok Hwee
Regular Advisor

NFS Mount

Gd Day Forum,

- I have 2 servers A and B each having same file system name /opt/apps. On server A, I have a directory /opt/apps/arch_test having the following permissions,

drwx------ 5 sapusr sapgrp 96 Oct 1 17:48 test_arch

Query: I would like to allow server B user sapusr to be able to access server A /opt/apps/arch_test directory using the same /opt/apps/arch_test directory path. How am I able to achieve this?

Thks/cliff
23 REPLIES 23
Bharat Katkar
Honored Contributor

Re: NFS Mount

Hi,

1. Configure Server A as NFS server and B as NFS client
2. Create arch_test directory in B
# mkdir /opt/apps/arch_test
3. Export arch_test from A using exportfs and similarly mount the same on B on /opt/apps/arch_test

Check this files for NFS configuration:
/etc/rc.config.d/nfsconf,/etc/exports
See man exportfs,nfs.

Regards,

You need to know a lot to actually know how little you know
Denza
Occasional Contributor

Re: NFS Mount

Hi,

agreed, mount it as a network file system under a different mount point.

While it's tacky SAM is the simplest way to configure this - just check the config files after to make sure you are happy.

D
Muthukumar_5
Honored Contributor

Re: NFS Mount

We can do this as,

Server A
-------
drwx------ 5 sapusr sapgrp 96 Oct 1 17:48 test_arch

Give permission to only serverB
# exportfs -iv /opt/apps -o root=serverB

Display exported file systems
# exportfs -v

Server B:
mount serverA:/opt/apps /opt/apps/arch_test
It will be mounted there.

You can check as,
mount / bdf

If you want to have them default mounting then,

serverA:
/etc/exports
put that entry here.

serverB:
/etc/mnttab to keep the mounting by default.

Now root user and sapusr user, sapgrp users can access it.
Easy to suggest when don't know about the problem!
Govind_3
Regular Advisor

Re: NFS Mount

As long as you dont have any files and folders under serverB:/opt/apps/arch_test, by which I mean you have an empty directory on serverB this should be ok to mount the /opt/apps/arch_test from server A onto server B.
1)Share it from ServerA with the right permissions and access rights
2)mount it onto serverB:/opt/apps/arch_test
it doesnt even matter what permissions you have on the mount directory the permissions on serverA will limit the users read, write, execute capability.
-Cheers
Govind
Dave Olker
Neighborhood Moderator

Re: NFS Mount

Hi Cliff,

Were you able to get this working with the suggestions in this thread or do you still need help? If you did get it working, be sure to assign points to those that helped you.

Regards,

Dave


I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo
Cliff Lim Kok Hwee
Regular Advisor

Re: NFS Mount

Gd Day Forum,

Sorry for the late submission of points cos I was offline.

Guys,

I review thru your help and please answer my queries:

Give permission to only serverB
# exportfs -iv /opt/apps -o root=serverB

Display exported file systems
# exportfs -v

Server B:
mount serverA:/opt/apps /opt/apps/arch_test

Query:

I need to access serverA /opt/apps/arch_test from serverB. If u perform the above mount, it will only bring me to serverA /opt/apps. Am I correct to say that?

Cos my application need to write to server A /opt/apps/arch.

thanks/cliff
Dave Olker
Neighborhood Moderator

Re: NFS Mount

Hi Cliff,

You wrote:
___________________________________________

Give permission to only serverB
# exportfs -iv /opt/apps -o root=serverB

Display exported file systems
# exportfs -v
___________________________________________

First of all, this syntax is incorrect and will likely result in a usage string being printed by exportfs. The target filesystem needs to be the last entry in the syntax, so the correct way to use the above options would be:

# exportfs -iv -o root=serverB /opt/apps

However, this syntax will not restrict the filesystem to only client "serverB". It will allow any NFS client to mount the /opt/apps directory. All this syntax will restrict is which clients are allowed to send NFS requests for this filesystem as if they were the root user on the NFS server. In this case, only the root user on system "serverB" will be able to access files on the exported filesystem as if he/she were the root user on the NFS server. Root users from all other clients will have their requests re-mapped to a uid of -2.

Again, any NFS client will be able to mount the filesystem using the above corrected syntax. If you really want to restrict access to this filesystem to only "serverB" then the syntax would be:

# exportfs -iv -o access=serverB /opt/apps

However, this syntax will not allow the root user on "serverB" to send NFS requests for this filesystem as a root user. If you need the root user on "serverB" to be able to send requests as the root user then the syntax would be:

# exportfs -iv -o access=serverB,root=serverB /opt/apps


You also wrote:
__________________________________________

Server B:
mount serverA:/opt/apps /opt/apps/arch_test

Query:

I need to access serverA /opt/apps/arch_test from serverB. If u perform the above mount, it will only bring me to serverA /opt/apps. Am I correct to say that?

Cos my application need to write to server A /opt/apps/arch.
__________________________________________


The above mount syntax will not work for your purposes. You are mounting the "/opt/apps" directory as "/opt/apps/arch_test" on the client. If you do this then when the client creates files in it's version of /opt/apps/arch_test, the files will show up on the server in the /opt/apps directory. I don't think this is what you want.

If you really only want the client to see the /opt/apps/arch_test directory then you should only export this directory:

# exportfs -iv -o access=serverB,root=serverB /opt/apps/arch_test

You should then mount this directory on serverB:

mount serverA:/opt/apps/arch_test /opt/apps/arch_test

That way the client will see the "arch_test" directory when it looks in it's /opt/apps/arch_test directory.

Again, whether you export with the "root=" option only depends on whether you need the root user on serverB to access files on the server as a root user. If not, you can remove the "root=" syntax from the above exportfs command.

Let me know if you have any questions about these recommendations.

Regards,

Dave


I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo
Cliff Lim Kok Hwee
Regular Advisor

Re: NFS Mount

Gd Afternoon Forumers,

Can anyone advise me how to allow the exported directory /opt/apps/arch_test from serverA to be permanent available mounted on serverB after a system reboot.

Any work to be done at both serverA and serverB?

thanks/cliff

Stefan Schulz
Honored Contributor

Re: NFS Mount

Hi,

just add the mount in your /etc/fstab. So this filesystem will be mouonted ad boot time.

The entry on serverB should look something like:

serverA:/opt/apps/arch_test /opt/apps/arch_test nfs rw,suid 0 0

Hope this helps.

Regards Stefan
No Mouse found. System halted. Press Mousebutton to continue.
Cliff Lim Kok Hwee
Regular Advisor

Re: NFS Mount

Gd Day Stefan,

serverA:/opt/apps/arch_test /opt/apps/arch_test nfs rw,suid 0 0

Query:

- Is it necessary to add in rw and suid 0 0?
- I don't need we need to perform any setting on serverA which is the nfs server right? Correct me if I am wrong.

Thanks n Regards/cliff
Bharat Katkar
Honored Contributor

Re: NFS Mount

Hi,
You can also use Automounter Daemon.
Refer the link below on setting up NFS and Automounter.
http://www.uwsg.iu.edu/usail/network/nfs/admin.html

Hope that helps.
Regards,
You need to know a lot to actually know how little you know
Cliff Lim Kok Hwee
Regular Advisor

Re: NFS Mount

Hi,

@serverA
# ls -al |grep test_arch
drwx------ 3 root sys 96 Oct 4 14:52 test_arch
#exportfs -iv -o access=serverB test_arch
#showmount -e
/opt/perf/test_arch serverB

@serverB
mkdir /opt/perf/test_arch
# ls -al |grep test_arch
drwx------ 3 root sys 96 Oct 4 14:52 test_arch
mount serverB:/opt/perf/test_arch /opt/perf/test_arch

When I performed a cd /opt/perf/test_arch, it reported "/opt/perf/test_arch: permission denied"

Y is that so?

regards/cliff


Cliff Lim Kok Hwee
Regular Advisor

Re: NFS Mount

Forum,

@serverA,
I added into /etc/exports file the following single entry,
/opt/perf/test_arch -anon=2,access=ctss19,root=ctss19

and now when I tried running cd /opt/perf/test_arch @serverB the "Permission Denied" disappeared and I am able to R/W serverA /opt/perf/test_arch directory.

regards/cliff
Bharat Katkar
Honored Contributor

Re: NFS Mount

Hi,
what u have typed is:
# mount serverB:/opt/perf/test_arch /opt/perf/test_arch

It should be:

# mount serverA:/opt/perf/test_arch /opt/perf/test_arch

Regards,



You need to know a lot to actually know how little you know
Cliff Lim Kok Hwee
Regular Advisor

Re: NFS Mount

Hi Bharat,

Yes it is a typo error into ITRC but on serverB, I type mount serverA:/opt/perf/test_arch /opt/perf/test_arch.

Query: I added into serverB /etc/fstab as follows single entry,
serverA:/opt/perf/test_arch /opt/perf/test_arch nfs rw suid 0 0
to allow permanent/auto mount upon serverB reboot.

But it reported the error,
mount: ignoring incomplete/incorrect entry for hpsgmx53:/opt/perf/test_arch in /etc/fstab
mount: /opt/perf/test_arch was either ignored or not found in /etc/fstab

Query:

- Bearing in mind that /opt/perf/test_arch is a directory and not a filesystem is the above step applicable?

Please advise me.

Thanks n Regards/cliff
Bharat Katkar
Honored Contributor
Solution

Re: NFS Mount

Try this one on your Server B's fstab:

ServerB:/opt/perf/test_arch /opt/perf/test_arch nfs rw,hard 0 0

See if that works.
Regards,

You need to know a lot to actually know how little you know
Cliff Lim Kok Hwee
Regular Advisor

Re: NFS Mount

Thanks Bharat, it works.

Can explain what is being added?

thanks/cliff
Bharat Katkar
Honored Contributor

Re: NFS Mount

HI Cliff,
I am happy to see that working...great.

Well, the entry is as follows:
1. Remote FileSystem or Directory
2. Local Mount point
3. FileSystem Type i.e. nfs
4. Options used while mounting the FileSystem
5. Reserved for future use.
6. Used by the fsck command to determine the order in which file system checks are done

For more information on mount options:
see man mount
and also have a look at man fstab.

Regards,


You need to know a lot to actually know how little you know
Stefan Schulz
Honored Contributor

Re: NFS Mount

Hi Cliff,

in the entry you put in the /etc/fstab it seams that there is a colon missing between rw and suid. Think thats the reason for this errormessage.

Regards

Stefan
No Mouse found. System halted. Press Mousebutton to continue.
Cliff Lim Kok Hwee
Regular Advisor

Re: NFS Mount

Gd Day Stefan,

I amended the /etc/fstab file as follows,

serverA:/opt/apps/arch_test /opt/apps/arch_test nfs rw:suid 0 0

But reported error message,

Illegal option rw:suid

thanks/cliff
Bharat Katkar
Honored Contributor

Re: NFS Mount

Hi Again,

You change that entry in fstab as follows:

serverA:/opt/apps/arch_test /opt/apps/arch_test nfs rw,suid 0 0

They are comma separated. This will allow ReadWrited Access along with SUID on the filesystem.
In the earlier example i had given you "rw,hard" that means it allows Readwrite access to the Filesystem with " Retry mount request until the server responds "

Hope that helps.
Regards,
You need to know a lot to actually know how little you know
Stefan Schulz
Honored Contributor

Re: NFS Mount

Hi again Cliff,

think the problem ist the dot (.) between rw and suid. You should put an comma (,) between them.

Sorry for confusing you with my bad english.

Regards

Stefan
No Mouse found. System halted. Press Mousebutton to continue.
Cliff Lim Kok Hwee
Regular Advisor

Re: NFS Mount

Thanks to ALL.

As for Bharat n Stefan, after changing the colon to comma, it works for the mounting.

Thanks/cliff