상현에 하루하루
개발자의 하루

Ubuntu NFS 설정

( 업데이트: )

NFS 서버 설정

NFS 서버 패키지 설치

apt-get install nfs-common nfs-kernel-server rpcbind portmapCode language: JavaScript (javascript)

공유할 폴더 생성

mkdir /mnt/data
chmod -R 777 /mnt/data

NFS 설정 수정

설정 파일은 /etc/exports 파일이다.

아래는 NFS를 걸 폴더는 /mnt/data이고 173.31.0.0/16에 대해 모두 권한을 주겠다는 뜻이다.

/mnt/data 172.31.0.0/16(rw,sync,no_subtree_check)
rwread and write operations
syncwrite any change to the disc before applying it
no_subtree_checkprevent subtree checking

반영

exportfs -a
systemctl restart nfs-kernel-server

클라이언트

NFS 클라이언트 패키지 설치

apt-get install nfs-commonCode language: JavaScript (javascript)

NFS 마운트할 폴더 생성

mkdir /data

마운트

NFS서버 아이피가 192.168.1.1이라고 하면

mount -t nfs 192.168.1.1:/mnt/data /dataCode language: JavaScript (javascript)

위처럼 원격 또는 다른 네트워크의 폴더와 마운트할 수 있다.