How to configure NFS server and client in Solaris 11
My Server is solaris 11 (192.168.120.10) and my client is client1 (192.168.120.11)
NFS Server :
Step 1 : Create a directory and share it in read write mode.
root@solanfsserver:~# mkdir /tmp/nfstest
root@solanfsserver:~# share -F nfs -o rw /tmp/nfstest
Step 2: Check the status of NFS services.
root@solanfsserver:~# svcs -a | grep -i nfs
disabled 22:53:07 svc:/network/nfs/cbd:default
disabled 22:53:08 svc:/network/nfs/client:default
online 22:53:34 svc:/network/nfs/fedfs-client:default
online 23:06:17 svc:/network/nfs/status:default
online 23:06:17 svc:/network/nfs/mapid:default
online 23:06:17 svc:/network/nfs/nlockmgr:default
online 23:06:18 svc:/network/nfs/rquota:default
online 23:06:18 svc:/network/nfs/server:default
Client Side configuration
Step 3 : Check the share from NFS server bearing IP address 192.168.120.10 Before mounting the file system.
root@client1:~# dfshares 192.168.120.10
RESOURCE SERVER ACCESS TRANSPORT
192.168.120.10:/tmp/nfstest 192.168.120.10 – –
root@client1:~# svcs -a | grep nfs
disabled 22:53:06 svc:/network/nfs/mapid:default
disabled 22:53:06 svc:/network/nfs/status:default
disabled 22:53:06 svc:/network/nfs/nlockmgr:default
disabled 22:53:06 svc:/network/nfs/cbd:default
disabled 22:53:06 svc:/network/nfs/client:default
disabled 22:53:07 svc:/network/nfs/server:default
disabled 22:53:42 svc:/network/nfs/rquota:default
online 22:53:37 svc:/network/nfs/fedfs-client:default
Step 5 : Mounted the NFS file system on client side successfully and unmounted it after that.
root@client1:~# mount -F nfs 192.168.120.10:/tmp/nfstest /mnt
root@client1:~# df -h /mnt
Filesystem Size Used Available Capacity Mounted on
192.168.120.10:/tmp/nfstest
4.6G 32K 4.6G 1% /mnt
root@client1:~# umount /mnt
Example:
sharing /data mount point as read/write to hosts nfsclient1 and nfsclient2 only. Here rw=options is a Access control list. (IPs can be specified instead of hostnames here)
# share -F nfs -o rw=nfsclient1:nfsclient2 /data
Solaris 10 ZFS way
Similar example as above for solaris 10 ZFS file system would be :
# zfs set sharenfs='rw=nfsclient1:nfsclient2' datapool/dataTo un-share the file system we shared :
# zfs unshare datapool/data
Solaris 11 ZFS way
In case of solaris 11 the syntax differs completely from solaris 10. Here we need to name the share while sharing it.
# zfs set sharenfs=on datapool/data
# zfs set share=name=datashare,path=/data,prot=nfs,rw=nfsclient1,nfsclient1 datapool/data
Sharing using dfstab
The NFS shares, shared using the share command won’t persist across reboots. The solution to this is using the /etc/dfs/dfstab file. The general format of a NFS entry in dfstab file is:
share -F nfs -o rw=nfsclient1 -d "Home Dir" /export/homeAfter adding the entries to the dfstab we need to use the shareall command to share the entities mentioned in the dfstab
# shareall
Now, similar to shareall, to un-share all the NFS shares in one go use :
# unshareallNow, similar to /etc/vfstab, all the NFS shares that are currently shares are listed in the /etd/dfs/sharetab file.
NFS server/client Start/Stop
Before you can start sharing NFS shares and mounting them on remote server, you must start the NFS server and NFS client.
For Solaris 8,9 :
# /etc/init.d/nfs.server start
# /etc/init.d/nfs.server stop
For Solaris 10 :
# svcadm enable svc:/network/nfs/server:default
# svcadm disable svc:/network/nfs/server:default
0 Comments