Do this in tokyodb01
1. Check if nfs services is online (you should see an online or offline when you execute the command).
#svcs network/nfs/server
2. If the nfs services is offline execute the following command (if online just execute the last command)
#svcadm enable -r network/nfs/server
#svcadm enable -s network/nfs/server
------------------------------------------------------------------
if you are enabling nfs first time on yor server , You may get the following error:
svcadm: Instance "svc:/network/nfs/server:default" has been disabled by another entity
To resolve this, just add one line /etc/dfs/dfstab like below
share -F nfs -o ro /var/tmp and then run the below command again:
svcadm enable -s network/nfs/server
---------------------------------------------------------------------
#svcadm restart network/nfs/server
3. Verify if the nfs service is already online by executing the command
#svcs network/nfs/server
4. To share the directory (/u10), edit /etc/dfs/dfstab (if dfstab does not exist, create it)
#vi /etc/dfs/dfstab
in vi, add this
share -F nfs /u10
share -F nfs -o rw=tokyodb01:tokyodb05,root=tokyodb01:tokyodb05 /u10/oracle
save and quit
5. Execute the command
share -F nfs -o rw=tokyodb01:tokyodb05,root=tokyodb01:tokyodb05 /u10/oracle
#shareall -F nfs
6. Verify the share, the output should look like this
#share
- /u10 rw ""
7. Note rw means read/write means anyone can read/write on the shared directory /u10, if you want some restriction please read man dfstab.
Do this in tokyodb02
1. Check also if nfs services is running by following the procedure above.
2. Make a directory as your mounting point
#mkdir /u10_tkdb01 (note: you can name the directory, any
name you want)
3. Mount the share directory of tokyodb01
#mount -F nfs tokyodb01:/u10 /u10_tkdb01
mount -F nfs tokyodb01:/u10/oracle /u10
4. Check if already mounted
# df -k (you should see the tokyodb01:/u10 mounted on
/u10_tkdb01)
5. You can now use the directory /u10_tkdb01
#cd /u10_tkdb01
#ls (it should have an output similar to /u10 of tokyodb01)
NFS is a relatively uncomplicated functionality of any Unix system. However, from time to time you are bound to run in the “permission denied” error while trying to NFS-mount a filesystem. Everything seems to be shared correctly and, yet, the “permission denied” error persists. Here are a few things you may want to do to resolve the problem.
First, the correct syntax for sharing and mounting filesystems. Solaris 8 is used in this example.
You can create a one-time share and one-time mount for temporary use. These will go away after either the source or the client machine is rebooted. Alternatively, you can created a share that will be re-shared or re-mounted at boot time. The simple syntax for a one-time NFS mount is as follows.
Let’s say you want to mount /var/log from server1 to server2 and server3 in read/write mode with root-level access. This means that once /var/log is NFS-mounted on server2 and server3, the root user on these systems will have full access to this filesystem (see diagram below).
1) On the system FROM which you are exporting the filesystem (server1 in this example) you need to make sure the NFS server is running:
ps -ef | grep nfsdYou should see something like this:
daemon 365 1 0 Dec 12 ? 0:55 /usr/lib/nfs/nfsdIf you have no NFS shares on this system, it is possible that the nfsd daemon is not started at boot time. In this case you will need to start it manually:
/etc/init.d/nfs.server startOn Solaris 8 or 9 system you need to see nfsd, lockd, and statd running. If any of them are missing, make sure you have at least one NFS share in /etc/dfs/dfstab and restart the NFS server:
/etc/rc2.d/k28nfs.server stop
/etc/rc2.d/k28nfs.server start2) Now run the share command for the particular filesystem you want to export:
share -F nfs -o rw=server2:server3,root=server2:server3 /var/log3) To check which filesystems you have exported, run the following command:
exportfsThe output would look like this:
server1 - 10:29:42 /etc:[626] exportfs
- /var/log root=server2:server3,rw=server2:server3 ""4) On the system(s) on which you are MOUNTING the NFS filesystem (serve2, server3 in this example) you will need to create a mount point:
mkdir /server1_var_log5) Now start the NFS client if it is not already running:
/etc/init.d/nfs.client start6) Finally, run the mount command:
mount -F nfs server1:/var/log /server1_var_logTo create a permanent NFS mount which will be automatically shared/mounted every time either the server or the client reboots, you will need to edit two files.
1) On the source server (server1) edit the /etc/dfs/dfstab file to include the following entry:
share -F nfs -o rw=server2:server3,root=server2:server3 /var/log2) On the source server run:
shareallTo check what’s being shared, run exportfs or look inside the /etc/dfs/dfstab file.
3) On the client server(s) (server2 and server3) edit the /etc/vfstab file to include the following entry:
server1:/var/log - /server1_var_log nfs - yes -4) On the client server(s) run:
mountallTo check what’s being mounted, do df -k | grep server1
If you did everything correctly, you will have a new NFS mount. However, sometimes you may get the “Permission denied” error. To resolve it try the following:
1) Use the fully-qualified DNS names of the source and client machines. This means that every instance of server1, server2, and server3 in the examples above needs to be replaced with server1.domain.com, server2.domain.com, and server3.domain.com, correspondingly. If this helps, take a look at the /etc/nsswitch.conf on the NFS server. For systems using both DNS and NIS for hostname resolution, the “hosts” line of nsswitch.conf should look like this:
hosts files nis dns [NOTFOUND=return]Make this change and see if that allows you to export NFS shares without having to use fully-qualified hostnames of clients.
2) If this does not help, try to export a filesystem in a more general fashion:
share -F nfs /var/logor you can try this:
share -F nfs -o root=server2.domain.com:server3.domain.com /var/log
No comments:
Post a Comment