오래전 이야기/Server

NFS

리눅스 엔지니어였던 2008. 9. 15. 16:44

NFS

Last update: 2006/8/7
Since: 1994/2/22
Here -- Installation & Setup -- Linux


  1. Display info.
    1. Status
      • % mount
        % showmount -e hostname ...... What are exported by hostname.

    2. Statistics
      • % nfsstat -s
        % nfsstat -c

  2. Client (RH7.1)
    1. Access control
      Check /etc/sysconfig/ipchains, and add the following if needed.
        -A input -s 130.87.xxx.xxx -d 0/0 -p udp -j ACCEPT
      !! Don't forget to restart ipchains after you changed the parameter.
        # service ipchains restart
    2. Starting daemons
      To start automatically at boot time.
        # chkconfig portmap on
        # chkconfig nfslock on
        # chkconfig autofs on
      Staring manually.
        # service portmap start
        # service nfslock start
        # service autofs start

  3. Automount client (RH7.2, Turbo7)
    1. Create a mount directory.
        # mkdir /misc
    2. Add the following entry into /etc/auto.master.
        /misc /etc/auto.misc
    3. A sample of /etc/auto.misc file.
        Q_and_A -ro,intr fs.kek.jp:/public/linux/Support/Q_and_A
        Tips -ro,intr fs.kek.jp:/public/linux/Support/Tips
    4. Access control
        Refer to "2. Client".
    5. Starting daemons
        Refer to "2. Client".
    6. Confirmation
        $ ls /misc/Q_and_A /misc/Tips

  4. Server (Linux)
    1. Starting NFS server.
      With Turbo workstation 8 on 2002/9/12.
      • Access control
        Allow portmap access in /etc/hosts.allow. A sample is,
          portmap: soleil.kek.jp 130.87.32.99
        After chaning /etc/hosts.allow, portmap and nfs(mountd) need to be restarted.

      • # /etc/rc.d/init.d/portmap start

      • # /etc/rc.d/init.d/nfs start
        Following daemons will be started.
          Starting NFS services:
          Starting NFS quotas: OK
          Starting NFS mountd: OK
          Starting NFS daemon: OK
        If portmap is not started....
        -->
        # /usr/sbin/rpc.rquotad
        Cannot register service: RPC: Unable to receive; errno = Connection refused
        rpc.rquotad: unable to register (RQUOTAPROG, RQUOTAVERS, udp).
        -->
        /usr/sbin/rpc.mountd
        Cannot register service: RPC: Unable to receive; errno = Connection refused

    2. A sample of /etc/exports.
        /Lib soleil.kek.jp(rw)
        /home lune.kek.jp(rw) soleil.kek.jp(rw)
    3. Other operations.
      • After changing /etc/exports
        # /etc/rc.d/init.d/nfs reload
          or
        # exportfs -a

    4. Display status.
        #/usr/sbin/exportfs
        #/usr/sbin/showmount -a

  5. Sun4
    1. Automount client
      • Insert following line in "/etc/rc.local" to start automount daemon
          /usr/etc/automount -m -f /etc/auto.master

      • Automount description
        /etc/auto.master # mount point map file option /- /etc/auto.direct soft /home /etc/auto.indirect /etc/auto.direct # keyoption location /fs -ro fs:/public/linux /etc/auto.indirect # keyoption location cc -rw,soft procyon:/home/cc 
        * Mount point must be created previously.

    2. Clients (Sun4)
      • Start-up
        biod daemons are started from /etc/rc.local

      • NFS mount automatically at system boot time
        Entries in "/etc/fstab".
        example) /dev/sd3a / 2 rw,nosuid 1 1 /dev/sd3d /usr 2 rw 1 2 /dev/sd3e /home 2 rw 1 3 fs:/public/sun /mnt/fs nfs ro,soft,retry=1 0 0 
        (4th line is NFS mount; mounts "/public/sun" of fs onto "/mnt/fs" with read only mode.)

      • Manual mounting
          # mount -o option hostname:remote-filesystem local-directory
        For example....
          # mount -o soft fs.kek.jp:/public/sun /mnt/fs
        unmount
          # umount /mnt/fs

      • Mounting all files of a file type.
        When you changed NFS mount entry in /etc/fstab, enter the following command to activate new discription.
          # umount -a -t nfs
          # mount -a -t nfs

    3. Server (Sun4)
      • System files
        System program ... exportfs
        Daemons ...... rpc.mounted & nfsd

      • Start-up
        /etc/rc.local
          Calls exportfs ------ Reads /etc/exports, Creates /etc/xtab
          Calls nfsd
          Calls rpc.mountd ---- Reads /etc/xtab

      • The directories to be shared are listed in "/etc/exports".
        example) /home -access=host1:host2 ..... Permit to host1 & host2. /usr/local -ro,access=host3 ..... Permit to host3 with read only mode. /share -root=host1 ..... Permit to any hosts, Petmit to SU of host1. 
      • Manual operation
        When you modified /etc/exports, the following procedure will make new list valid.
          # exportfs -a
        Confirmation
          % exportfs

    4. Synchronization (Sun4)
    5. Time synchronization will be required.
        # rdate hostname


===========================

<출처: http://ccweb1.kek.jp/people/yashiro/guide/linux/manage/setup/nfs.html >