Friday 3 January 2014

SOLARIS 11 NFS & AUTOFS CONFIGURATION

Automatic File System Sharing
In the Oracle Solaris 11 release, the share command creates permanent shares that are automatically shared during system startup. Unlike previous releases, you will not need to edit the /etc/dfs/dfstab file to record the information about shares for subsequent reboots. The /etc/dfs/dfstab is no longer used.
How to Set Up Automatic File-System Sharing
# share -F nfs -o specific-options pathname
 # share -F nfs
 -        /export/share/man   sec=sys,ro   ""
 -        /usr/src     sec=sys,rw=eng   ""
 -        /export/ftp    sec=sys,ro,public  ""
How to Enable WebNFS Access
# share -F nfs -o ro,public,index=index.html /export/ftp
# share -F nfs
-        /export/share/man   sec=sys,ro   ""
-        /usr/src     sec=sys,rw=eng   ""
-        /export/ftp    sec=sys,ro,public,index=index.html  ""

Share file system:
#zpool create mypool c2d2  c2d1
root@sairam:~# share /mypool
root@sairam:~# share
mypool  /mypool nfs     sec=sys,rw
root@sairam:~# cat /etc/dfs/dfstab
# Use the share(1m) or zfs(1m) commands for all share management
# This file is no longer supported or used in share management
# Configuration information can be imported into the system by running
# an existing dfstab file as a script.
#
root@sairam:~# share
mypool  /mypool nfs     sec=sys,rw
root@sairam:~# reboot
login as: root
Using keyboard-interactive authentication.
Password:
root@rama:~# share
mypool  /mypool nfs     sec=sys,rw
root@rama:~# cat /etc/dfs/sharetab
/mypool mypool  nfs     sec=sys,rw
root@rama:~# cat /etc/dfs/dfstab
# Use the share(1m) or zfs(1m) commands for all share management
# This file is no longer supported or used in share management
# Configuration information can be imported into the system by running
# an existing dfstab file as a script.
#
root@rama:~# cat /etc/default/nfs
#
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
#
#
# Moved to SMF. Use sharectl(1M) to manage NFS properties.
root@rama:~# sharectl status
autofs  online client
nfs     online
smb     -

root@rama:~# cat /etc/default/fs
LOCAL=ufs
root@rama:~# cat /etc/dfs/fstypes
nfs NFS Utilities
smb SMB Utilities
autofs AUTOFS Utilities
smbfs CIFS Utilities
root@rama:~# cat /etc/default/nfs
nfs      nfslogd
root@rama:~# cat /etc/default/nfs
#
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
#
#
# Moved to SMF. Use sharectl(1M) to manage NFS properties.
#
root@rama:~# cat /etc/default/nfslogd
#
#ident  "%Z%%M% %I%     %E% SMI"
#
# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
# Specify the maximum number of logs to preserve.
#
# MAX_LOGS_PRESERVE=10
# Minimum size buffer should reach before processing.
#
# MIN_PROCESSING_SIZE=524288
# Number of seconds the daemon should sleep waiting for more work.
#
# IDLE_TIME=300
# CYCLE_FREQUENCY specifies the frequency (in hours) with which the
# log buffers should be cycled.
#
# CYCLE_FREQUENCY=24
# Use UMASK for the creation of logs and file handle mapping tables.
#
# UMASK=0137
How to enable NFS Loging:-
root@rama:~# cat /etc/default/nfslogd
#
#ident  "%Z%%M% %I%     %E% SMI"
#
# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
# Specify the maximum number of logs to preserve.
#
# MAX_LOGS_PRESERVE=10
# Minimum size buffer should reach before processing.
#
# MIN_PROCESSING_SIZE=524288
# Number of seconds the daemon should sleep waiting for more work.
#
# IDLE_TIME=300
# CYCLE_FREQUENCY specifies the frequency (in hours) with which the
# log buffers should be cycled.
#
# CYCLE_FREQUENCY=24
# Use UMASK for the creation of logs and file handle mapping tables.
#
# UMASK=0137
root@rama:~# cat /etc/nfs/nfslog.conf
#
#ident  "%Z%%M% %I%     %E% SMI"
#
# Copyright (c) 1999 by Sun Microsystems, Inc.
# All rights reserved.
#
# NFS server log configuration file.
#
# <tag> [ defaultdir=<dir_path> ] \
#       [ log=<logfile_path> ] [ fhtable=<table_path> ] \
#       [ buffer=<bufferfile_path> ] [ logformat=basic|extended ]
#
global  defaultdir=/var/nfs \
        log=nfslog fhtable=fhtable buffer=nfslog_workbuffer

#cd /var/nfs
#ls
.            ..           v4_oldstate  v4_state
# zfs create mypool/fs1
# share -F nfs -o log=global /mypool/fs1
# share -F nfs
mypool  /mypool sec=sys,rw
mypool_fs1      /mypool/fs1     log=global,sec=sys,rw
#cd /var/nfs
#ls
nfslog_workbuffer_log_in_process  v4_oldstate                       v4_stat
# file *
nfslog_workbuffer_log_in_process:       data
v4_oldstate:    directory
v4_state:       directory
~# ps -aef|grep nfs
  daemon   772     1   0 16:52:25 ?           0:00 /usr/lib/nfs/statd
  daemon   774     1   0 16:52:25 ?           0:01 /usr/lib/nfs/nfsmapid
  daemon  3814     1   0 17:13:08 ?           0:00 /usr/lib/nfs/nfsd
  daemon   798     1   0 16:52:27 ?           0:00 /usr/lib/nfs/lockd
    root  3825  2124   0 17:13:37 pts/1       0:00 grep nfs
    root  3815     0   0 17:13:08 ?           0:00 nfsd_kproc
    root  3812     1   0 17:13:08 ?           0:00 /usr/lib/nfs/mountd
#/usr/lib/nfs/nfslogd &
# ps -aef|grep nfs
  daemon   772     1   0 16:52:25 ?           0:00 /usr/lib/nfs/statd
  daemon   774     1   0 16:52:25 ?           0:01 /usr/lib/nfs/nfsmapid
    root  3827     1   0 17:14:06 ?           0:00 /usr/lib/nfs/nfslogd
  daemon  3814     1   0 17:13:08 ?           0:00 /usr/lib/nfs/nfsd
  daemon   798     1   0 16:52:27 ?           0:00 /usr/lib/nfs/lockd
    root  3831  2124   0 17:14:15 pts/1       0:00 grep nfs
    root  3815     0   0 17:13:08 ?           0:00 nfsd_kproc
    root  3812     1   0 17:13:08 ?           0:00 /usr/lib/nfs/mountd
# svcadm  restart nfs/server
~# ps -aef|grep nfs
  daemon   772     1   0 16:52:25 ?           0:00 /usr/lib/nfs/statd
  daemon   774     1   0 16:52:25 ?           0:01 /usr/lib/nfs/nfsmapid
    root  3874  2124   0 17:14:49 pts/1       0:00 grep nfs
  daemon   798     1   0 16:52:27 ?           0:00 /usr/lib/nfs/lockd
  daemon  3864     1   0 17:14:43 ?           0:00 /usr/lib/nfs/nfsd
    root  3865     0   0 17:14:43 ?           0:00 nfsd_kproc
    root  3862     1   0 17:14:43 ?           0:00 /usr/lib/nfs/mountd
CLIENT:-
How to Mount a File System at Boot Time
#vi /etc/vfstab
wasp:/mypool - /mntpoint  nfs - yes rw
How to Mount a File System From the Command Line
~# mount -F nfs 10.66.10.107:/mypool /a
df -kh /a
Filesystem             Size   Used  Available Capacity  Mounted on
10.66.10.107:/mypool    18G    33K        18G     1%    /a
Mounting With the Auto mounter:-
~# cat /etc/auto_master
#
# Copyright (c) 1992, 2011, Oracle and/or its affiliates. All rights reserved.
#
# Master map for automounter
#
+auto_master
/net            -hosts          -nosuid,nobrowse
/home           auto_home       -nobrowse
/nfs4           -fedfs          -ro,nosuid,nobrowse
# cd /net/10.66.10.107
#cd mypoo/fs1
#ls
#df -kh
10.66.10.107:/mypool    18G    33K        18G     1%    /a
/                       34G   6.1G        28G    18%    /net/10.66.10.101
10.66.10.107:/          15G   4.5G        10G    31%    /net/10.66.10.107
10.66.10.107:/mypool    18G    33K        18G     1%    /net/10.66.10.107/mypool
10.66.10.107:/mypool/fs1
                        20G   1.3G        18G     7%    /net/10.66.10.107/mypool/fs1
rama:/                  15G   4.5G        10G    31%    /net/rama
rama:/mypool            18G    33K        18G     1%    /net/rama/mypool
rama:/mypool/fs1        20G   1.3G        18G     7%    /net/rama/mypool/fs1
How to Mount All File Systems from a Server[mirror mounting]:-
This release includes the mirror mount facility, which allows a client to access all available file systems shared using NFS from a server, once one mount from that server has succeeded.
# mount
/ on rpool/ROOT/bkpsoalris read/write/setuid/devices/rstchown/dev=3910002 on Thu Jan  1 05:30:00 1970
/devices on /devices read/write/setuid/devices/rstchown/dev=9700000 on Fri Apr  5 16:51:13 2013
/dev on /dev read/write/setuid/devices/rstchown/dev=9780000 on Fri Apr  5 16:51:13 2013
/system/contract on ctfs read/write/setuid/devices/rstchown/dev=97c0001 on Fri Apr  5 16:51:13 2013
/proc on proc read/write/setuid/devices/rstchown/dev=9740000 on Fri Apr  5 16:51:13 2013
/etc/mnttab on mnttab read/write/setuid/devices/rstchown/dev=9800001 on Fri Apr  5 16:51:13 2013
/system/volatile on swap read/write/setuid/devices/rstchown/xattr/dev=9840001 on Fri Apr  5 16:51:13 2013
/system/object on objfs read/write/setuid/devices/rstchown/dev=9880001 on Fri Apr  5 16:51:13 2013
/etc/dfs/sharetab on sharefs read/write/setuid/devices/rstchown/dev=98c0001 on Fri Apr  5 16:51:13 2013
/dev/fd on fd read/write/setuid/devices/rstchown/dev=99c0001 on Fri Apr  5 16:51:58 2013
/var on rpool/ROOT/bkpsoalris/var read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=3910003 on Fri Apr  5 16:51:59 2013
/tmp on swap read/write/setuid/devices/rstchown/xattr/dev=9840002 on Fri Apr  5 16:51:59 2013
/export on rpool/export read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=3910004 on Fri Apr  5 16:52:15 2013
/export/home on rpool/export/home read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=3910005 on Fri Apr  5 16:52:15 2013
/export/home/sai on rpool/export/home/sai read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=3910006 on Fri Apr  5 16:52:15 2013
/mypool on mypool read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=3910007 on Fri Apr  5 16:52:15 2013
/rpool on rpool read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=3910008 on Fri Apr  5 16:52:15 2013
/mypool/fs1 on mypool/fs1 read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=3910009 on Fri Apr  5 17:04:42 2013

# mount 10.66.10.10.107:/ /mnt
nfs mount: 10.66.10.10.107: Unknown host
# mount 10.66.10.107:/ /mnt

# df -kh
Filesystem             Size   Used  Available Capacity  Mounted on
rpool/ROOT/bkpsoalris
                        19G   4.5G        10G    31%    /
/devices                 0K     0K         0K     0%    /devices
/dev                     0K     0K         0K     0%    /dev
ctfs                     0K     0K         0K     0%    /system/contract
proc                     0K     0K         0K     0%    /proc
mnttab                   0K     0K         0K     0%    /etc/mnttab
swap                   1.9G   2.6M       1.9G     1%    /system/volatile
objfs                    0K     0K         0K     0%    /system/object
sharefs                  0K     0K         0K     0%    /etc/dfs/sharetab
fd                       0K     0K         0K     0%    /dev/fd
rpool/ROOT/bkpsoalris/var
                        19G   345M        10G     4%    /var
swap                   1.9G     0K       1.9G     0%    /tmp
rpool/export            19G    32K        10G     1%    /export
rpool/export/home       19G    32K        10G     1%    /export/home
rpool/export/home/sai
                        19G   693K        10G     1%    /export/home/sai
mypool                  20G    33K        18G     1%    /mypool
rpool                   19G    73K        10G     1%    /rpool
mypool/fs1              20G   1.3G        18G     7%    /mypool/fs1
10.66.10.107:/          15G   4.5G        10G    31%    /mnt
# cd /mnt
# ls
mypool
# cd mypool
# ls
fs1
# cd fs1
# ls
opt
# cd
:~# df -kh
Filesystem             Size   Used  Available Capacity  Mounted on
rpool/ROOT/bkpsoalris
                        19G   4.5G        10G    31%    /
/devices                 0K     0K         0K     0%    /devices
/dev                     0K     0K         0K     0%    /dev
ctfs                     0K     0K         0K     0%    /system/contract
proc                     0K     0K         0K     0%    /proc
mnttab                   0K     0K         0K     0%    /etc/mnttab
swap                   1.9G   2.6M       1.9G     1%    /system/volatile
objfs                    0K     0K         0K     0%    /system/object
sharefs                  0K     0K         0K     0%    /etc/dfs/sharetab
fd                       0K     0K         0K     0%    /dev/fd
rpool/ROOT/bkpsoalris/var
                        19G   345M        10G     4%    /var
swap                   1.9G     0K       1.9G     0%    /tmp
rpool/export            19G    32K        10G     1%    /export
rpool/export/home       19G    32K        10G     1%    /export/home
rpool/export/home/sai
                        19G   693K        10G     1%    /export/home/sai
mypool                  20G    33K        18G     1%    /mypool
rpool                   19G    73K        10G     1%    /rpool
mypool/fs1              20G   1.3G        18G     7%    /mypool/fs1
10.66.10.107:/          15G   4.5G        10G    31%    /mnt
10.66.10.107:/mypool    18G    33K        18G     1%    /mnt/mypool
10.66.10.107:/mypool/fs1
                        20G   1.3G        18G     7%    /mnt/mypool/fs1
How to Disable Large Files on an NFS Server
# cd /export/home1
# find . -xdev -size +2000000 -exec ls -l {} \;
# umount /export/home1\
# fsck /export/home1
# mount -F ufs -o nolargefiles /export/home1
#vi /etc/vfstab
/dev/dsk/c0t3d0s1 /dev/rdsk/c0t3d0s1 /export/home1  ufs  2  yes  nolargefiles
How to Use Client-Side Failover
In client:
#vi /etc/vfstab
bee,wasp:/export/share/local  -  /usr/local  nfs  -  no  ro

How to Disable Mount Access for One Client
# share -F nfs  ro=-rose:eng /export/share/man
- symbol indicate no access
How to Mount an NFS File System Through a Firewall
This procedure requires that the file system on the NFS server be shared by using the public option. Additionally, any firewalls between the client and the server must allow TCP connections on port 2049. All file systems that are shared allow for public file handle access, so the public option is applied by default.
# mount -F nfs bee:/export/share/local /mnt

How to Mount an NFS File System Using an NFS URL
# mount -F nfs nfs://rama:2049/mypool /a
# df -kh /a
Filesystem             Size   Used  Available Capacity  Mounted on
nfs://rama:2049/mypool
                        18G    33K        18G     1%    /a
  [OR]
# mount -F nfs -o vers=4 nfs://rama:2049/mypool /a
# df -kh /a
Filesystem             Size   Used  Available Capacity  Mounted on
nfs://rama:2049/mypool  18G    33K        18G     1%    /a
Setting up a DNS Record for a Federated File System Server
nslookup -q=srv _nfs4._domainroot._tcp.example.com bee.example.com
How to Start the NFS Services
# svcadm enable network/nfs/server
How to Stop the NFS Services
# svcadm disable network/nfs/server
How to Stop the Automounter
# svcadm disable system/filesystem/autofs
How to Select Different Versions of NFS on a Server
Change SMF parameters to set the NFS version numbers
# sharectl set -p server_versmax=3 nfs
# sharectl set -p server_versmin=3 nfs
# sharectl set -p server_delegation=on nfs
# sharectl set -p server_nfsmapid_domain=my.comany.com
# svcs network/nfs/server
# svcadm disable network/nfs/server
# svcadm enable network/nfs/server
How to Select Different Versions of NFS on a Client
Change SMF parameters to set the NFS version numbers.
# sharectl set -p client_versmax=3 nfs
# sharectl set -p client_versmin=3 nfs
Mount NFS on the client.
# mount server-name:/share-point /local-dir
How to Use the mount Command to Select Different Versions of NFS on a Client
# mount -o vers=value server-name:/share-point /local-dir
AUTOFS:-
Master Autofs Map:-
# cat /etc/auto_master
#
# Copyright (c) 1992, 2011, Oracle and/or its affiliates. All rights reserved.
#
# Master map for automounter
#
+auto_master
/net            -hosts          -nosuid,nobrowse
/home           auto_home       -nobrowse
/nfs4           -fedfs          -ro,nosuid,nobrowse
e# cat /etc/hosts
#
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# Internet host table
#
::1 rilcom localhost
127.0.0.1 rilcom localhost loghost
10.66.10.101   rilcom
10.66.10.107   rama
#cd /net
#ls
#cd rama
#df –kh

rama:/                  15G   4.5G        10G    31%    /net/rama
Direct maping:-
# cat /etc/auto_master
#
# Copyright (c) 1992, 2011, Oracle and/or its affiliates. All rights reserved.
#
# Master map for automounter
#
+auto_master
/net            -hosts          -nosuid,nobrowse
/home           auto_home       -nobrowse
/nfs4           -fedfs          -ro,nosuid,nobrowse
/rama           auto_my
/-              auto_dir
# cat /etc/auto_dir
/sai    rama:/mypool
# svcadm restart autofs
root@rilcom:~# svcs autofs
STATE          STIME    FMRI
online          3:03:40 svc:/system/filesystem/autofs:default
root@rilcom:~# cd /sai
root@rilcom:/sai# ls
fs1
# df -kh
Filesystem             Size   Used  Available Capacity  Mounted on
rpool/ROOT/newbesoalris
                        67G   6.1G        28G    18%    /
…………………..
rama:/mypool            18G    33K        18G     1%    /sai
# cd fs1
# df -kh
Filesystem             Size   Used  Available Capacity  Mounted on
rpool/ROOT/newbesoalris
                        67G   6.1G        28G    18%    /
rama:/mypool            18G    33K        18G     1%    /sai
rama:/mypool/fs1        20G   1.3G        18G     7%    /sai/fs1
#
INDirect mapping:-

# cat /etc/auto_master
#
# Copyright (c) 1992, 2011, Oracle and/or its affiliates. All rights reserved.
#
# Master map for automounter
#
/net            -hosts          -nosuid,nobrowse
/home           auto_home       -nobrowse
/nfs4           -fedfs          -ro,nosuid,nobrowse
+auto_master
/rama           auto_my
# cat /etc/auto_my
sai rama:/mypool/fs1
#df –kh
rama:/mypool/fs1        20G   1.3G        18G     7%    /rama/sai
using autofs we can mount file system when user login:-
# share
mypool_fs1      /mypool/fs1     nfs     anon=0,sec=sys,rw
# cat /etc/auto_master
#
# Copyright (c) 1992, 2011, Oracle and/or its affiliates. All rights reserved.
#
# Master map for automounter
#
+auto_master
/net            -hosts          -nosuid,nobrowse
/home           auto_home       -nobrowse
/nfs4           -fedfs          -ro,nosuid,nobrowse
/users          auto_users

# cat /etc/auto_users
home rama:/mypool/fs1
# svcadm restart autofs
# useradd -d /users/home/test -m test
80 blocks
# passwd test
New Password:
Re-enter new Password:
passwd: password successfully changed for test
# df -kh
Filesystem             Size   Used  Available Capacity  Mounted on
rpool/ROOT/newbesoalris
                        67G   6.1G        28G    18%    /
/devices                 0K     0K         0K     0%    /devices
/dev                     0K     0K         0K     0%    /dev
ctfs                     0K     0K         0K     0%    /system/contract
proc                     0K     0K         0K     0%    /proc
mnttab                   0K     0K         0K     0%    /etc/mnttab
swap                   2.9G   2.6M       2.9G     1%    /system/volatile
objfs                    0K     0K         0K     0%    /system/object
sharefs                  0K     0K         0K     0%    /etc/dfs/sharetab
fd                       0K     0K         0K     0%    /dev/fd
rpool/ROOT/newbesoalris/var
                        67G   297M        28G     2%    /var
swap                   2.9G    56K       2.9G     1%    /tmp
LDOMpool                67G    16G        51G    25%    /LDOM
rama:/mypool/fs1        20G   1.3G        18G     7%    /users/home
# su - test
Oracle Corporation      SunOS 5.11      11.0    November 2011
test@rilcom:~$ df -kh
Filesystem             Size   Used  Available Capacity  Mounted on
rpool/ROOT/newbesoalris
                        67G   6.1G        28G    18%    /
/devices                 0K     0K         0K     0%    /devices
/dev                     0K     0K         0K     0%    /dev
ctfs                     0K     0K         0K     0%    /system/contract
proc                     0K     0K         0K     0%    /proc
mnttab                   0K     0K         0K     0%    /etc/mnttab
swap                   2.9G   2.6M       2.9G     1%    /system/volatile
objfs                    0K     0K         0K     0%    /system/object
sharefs                  0K     0K         0K     0%    /etc/dfs/sharetab
fd                       0K     0K         0K     0%    /dev/fd
rpool/ROOT/newbesoalris/var
                        67G   297M        28G     2%    /var
swap                   2.9G    56K       2.9G     1%    /tmp
LDOMpool                67G    16G        51G    25%    /LDOM
rama:/mypool/fs1        20G   1.3G        18G     7%    /users/home
/users/home/test        20G   1.3G        18G     7%    /home/test




 

No comments:

Post a Comment