본문 바로가기

리눅스/이론

[리눅스] NFS mount 하기

* 마운트가 안될경우
mount -t nfs 192.168.100.110:/root/test /nfs/ -o vers=3
옵션 -o vers=3 을준다
NFS3 이 4로 마운트할때...



mount -t nfs servername:directory local_directory
mount -t nfs serverip:directory local_directory

예를 들어
서버 이름이 ubuntu 이고 ip가 192.168.0.2 라면

mount -t nfs ubuntu:/home/ubunutu /mnt/nfs
mount -t nfs 192.168.0.2:/home/ubunutu /mnt/nfs

- mount 해제하기

[root@localhost /]# umount -t nfs

- umount 실행시 아래과 같은 메세지 발생시

             "umount : 접근디렉토리: device is busy"

  원인 + 마운트 시킨 장치와 관련된 프로세스가 살아있는 경우

            + 자신이 마운트된 디렉토리 내부에 있는 경우

  처리방법

[root@localhost /]# fuser -km /home/webapps/upload 
 
또는 , sudo umount  디렉터리


  nfs를 사용하기 위해서는 "mount"의 명령으로 원격지의 nfs를 마운트 할 수 있다.(물론 서버에서 설정한 정당한 접근일 경우)

  $sudo mount -t nfs nfs_volume local_dir options

 

여기서 "-t nfs"와 "option"은 생략 가능하다. 주의할 점은 마운트하고자 하는 "local_dir"은 파일이나 하위 폴더가 없어야 한다. 그리고, "nfs_volume"은 목적지의 ip 주소나 호스트 네임이 될 수 있다.

  $sudo mount -t nfs 192.168.1.2:/home/test /mnt/test