ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • IBM AIX NFS mount 구성 방법
    System of Infra/Unix System 2020. 4. 21. 02:54
    반응형

    AIX로고이미지

    IBM AIX NFS mount 구성 방법

    [root@test_svr1:/]# ifconfig -a
    en3: flags=1e084863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN>
    inet 10.50.1.151 netmask 0xffffff00 broadcast 10.50.1.255
    tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1
    
    [root@test_svr2:/]# ifconfig -a
    en3: flags=1e084863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN>
    inet 10.50.1.152 netmask 0xffffff00 broadcast 10.50.1.255
    tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1

    -> test_svr1의 IP대역은 10.50.1.151, test_svr2의 IP대역은 10.50.1.152대역으로 설정 하였습니다.

    [root@test_svr1:/]# vi /etc/hosts
    10.50.1.151 test_svr1
    10.50.1.152 test_svr2
    
    [root@test_svr2:/]# vi /etc/hosts
    10.50.1.152 test_svr2
    10.50.1.151 test_svr1

    -> /etc/hosts 파일에 각 IP와 hostname을 넣어줍니다.

    [root@test_svr1:/]#smit mklv
    * VOLUME GROUP name [rootvg]
    Logical volume NAME [NFS_LV]
    * VOLUME GROUP name rootvg
    * Number of LOGICAL PARTITIONS [5]
    PHYSICAL VOLUME names [hdisk0]
    Logical volume TYPE [jfs2]
    POSITION on physical volume middle
    RANGE of physical volumes maximum

    -> nfs를 테스트할 LV를 하나 생성 해줍니다. 여기서는 임시로 간단하게 생성을 해 주었습니다. 그리고 파일시스템을 /nfs/nfs_second의 경로로 지정하여 만들어 주었습니다.

    [root@test_svr1:/]# mount /nfs/nfs_second

    ->파일시스템을 마운트 하였습니다.

    [root@test_svr1:/]# df -tg
    Filesystem GB blocks Used Free %Used Mounted on
    /dev/hd4 2.00 0.27 1.73 14% /
    /dev/hd2 5.00 4.19 0.81 84% /usr
    /dev/hd9var 5.00 0.29 4.71 6% /var
    /dev/hd3 2.00 1.01 0.99 51% /tmp
    /dev/hd1 2.00 0.00 2.00 1% /home
    /dev/hd11admin 1.00 0.00 1.00 1% /admin
    /proc - - - - /proc
    /dev/hd10opt 5.00 0.09 4.91 2% /opt
    /dev/livedump 0.25 0.00 0.25 1% /var/adm/ras/livedump
    /dev/ptflv 10.00 9.43 0.57 95% /ptf
    /dev/NFS_LV 1.25 0.00 1.25 1% /nfs/nfs_second

    -> /nfs/nfs_second가 마운트 된 것을 확인 할 수 있습니다.

    [root@test_svr1:/]# smit nfs
    ->Network File System (NFS)
    ->Add a Directory to Exports List
    * Pathname of directory to export [/nfs/nfs_second]
    Anonymous UID [0]
    Public filesystem? no
    * Export directory now, system restart or both both
    ...(생략)
    * Security method 1 [sys,krb5p,krb5i,krb5,dh]
    * Mode to export directory read-write
    Hostname list. If exported read-mostly [test_svr2]

    -> nfs를 등록해주기 위한 작업입니다. test_svr2의 export를 하게 된다면 read의 권한만 부여되도록 host리스트에 추가를 해주었습니다.

    [root@test_svr1:/nfs/nfs_second]# showmount -e
    export list for test_svr1:
    /nfs/nfs_second (everyone)
    
    [root@test_svr1:/]# cat /etc/exports
    /nfs/nfs_second -anon=0,sec=sys:krb5p:krb5i:krb5:dh,rw=test_svr2

    -> nfs가 등록되었을때 확인 할 수 있습니다.

    [root@test_svr1:/]# lssrc -g nfs
    Subsystem Group PID Status
    biod nfs 4128900 active
    rpc.statd nfs 4522126 active
    rpc.lockd nfs 4325520 active
    nfsd nfs 7733368 active
    rpc.mountd nfs 13566082 active
    nfsrgyd nfs inoperative
    gssd nfs inoperative

    -> nfs의 데몬이 살아 있는지 확인할 수 있는 명령어 입니다. nfsrgyd와 gssd를 제외하고 active의 상태면 default인 nfs데몬 상태입니다.

    [root@test_svr1:/]# stopsrc -g nfs
    [root@test_svr1:/]# startsrc -g nfs

    -> 테스트를 위해서 데몬을 중지시킨후 다시 시작을 해주는 작업을 해줍니다.

    [root@test_svr2:/]#mkdir nfs2
    
    [root@test_svr2:/]# ls -al | grep -i nfs2
    drwxr-xr-x 3 root system 256 Apr 21 01:01 nfs2

    -> test_svr2서버에서 nfs2의 디렉토리를 하나 생성해줍니다. 이유는 test_svr1에서의 파일시스템을 nfs mount 하기 위한 디렉토리 입니다.

    [root@test_svr2:/]# mount test_svr1:/nfs/nfs_second /nfs2

    -> nfs mount를 진행합니다.

    [root@test_svr2:/]# df -tg | grep nfs2
    test_svr1:/nfs/nfs_second 1.25 0.00 1.25 1% /nfs2

    -> test_svr2에서 nfs mount를 통해 test_svr1의 /nfs/nfs_second의 파일시스템을 mount했습니다.

    [root@test_svr1:/]# chfs -a size=5G /nfs/nfs_second
    Filesystem size changed to 10485760

    -> 해당경로에 파일을 생성하고 테스트 하기위해서 임의로 /nfs/nfs_second의 파일을 5G 증가 시켜줍니다.

    [root@test_svr1:/]# df -tg | grep -i /nfs/nfs_second
    /dev/NFS_LV 5.00 0.00 5.00 1% /nfs/nfs_second
    
    [root@test_svr2:/]# df -tg | grep -i /nfs2
    test_svr1:/nfs/nfs_second 5.00 0.00 5.00 1% /nfs2

    -> test_svr2의 파일용량이 test_svr1의 용량과 똑같은 모습을 볼 수 있습니다. 당연히 test_sv1의 파일시스템을 마운트 했으니 당연하겠죠?

    [root@test_svr1:/nfs/nfs_second]# cat test1
    nfs_success
    
    [root@test_svr1:/nfs/nfs_second]#mkdir test2
    [root@test_svr1:/nfs/nfs_second/test2]# vi nfs.sh
    
    [root@test_svr1:/nfs/nfs_second/test2]# cat nfs.sh
    banner nfs

    -> test_svr2에서 읽고 쓰기에 대한 테스트를 위해서 test_svr1에 편집기 파일과 쉘 하나를 임시로 생성 해주었습니다.

    [root@test_svr1:/nfs/nfs_second]#chmod 775 test1; chmod 775 test2

    -> 편집기 파일과 쉘의 권한을 775로 수정해 주었습니다.

    [root@test_svr2:/nfs2]# ls -al
    drwxr-xr-x 4 root system 256 Apr 21 01:37 .
    drwxr-xr-x 22 root system 4096 Apr 21 01:10 ..
    drwxr-xr-x 2 root system 256 Apr 21 01:01 lost+found
    -rwxrwxr-x 1 root system 12 Apr 21 01:36 test1
    drwxrwxr-x 2 root system 256 Apr 21 01:38 test2

    -> 권한이 변경 된 것을 확인 할 수 있습니다.

    [root@test_svr2:/nfs2]# cat test1
    nfs_success
    [root@test_svr2:/nfs2/test2]# ls -al | grep -i nfs.sh
    -rw-r--r-- 1 root system 19 Apr 21 01:38 nfs.sh

    -> test_svr2에서 편집기 파일을 열어보는것과 sh를 실행시키기 위해 준비 하였습니다.

    [root@test_svr2:/nfs2/test2]# sh nfs.sh
     #         #   ######     #####
     # #       #   #         #               
     #   #     #   #####      ####        
     #     #   #   #               #          
     #       # #   #         #    #  
     #         #   #          ####

    -> test_svr2에서 sh를 기동했을때 test_svr1에서 작성한 그대로 배너가 출력되는 모습입니다.

     

    PS. 포스팅의 내용은 제 기준으로 작성한 것이기 때문에 참고해서 보시면 감사하겠습니다.

    또한 맨텍 실습 교육을 통해 정리 후 포스팅한 글입니다.

    포스팅 과정의 오류 및 오타 그리고 궁금한 점에 대해서는 댓글 남겨주세요.

    반응형

    댓글

Designed by Tistory.