Ubuntu 16.04 nfs 서버 설정
1. 서버 프로그램 설치
root@com1:~# apt-get install nfs-common nfs-kernel-server portmap
2. 서버 설정root@com1:/home# vi /etc/exports
/home/nfs 192.168.9.* (rw,no_root_squash,async) 폴더경로 허용 IP (권한)
3. nfs 옵션
ro : read only mount rw : read/write mount no_root_squash : nfs 서버와 클라이언트의 root 사용자를 같도록 설정 no_all_squash : root 이외 모든 사용자에 대해 똑깥은 UID 를 가진 사용자는 동일한 권한 sync : 서버와 클라이언트 사이에 sync (서버에 데이터가 저장되었는지 확인) async : sync 옵션 미사용 (성능상으로는 향상) no_subtree_check (파티션 전체를 nfs 설정한 경우 전송율 상승)
4. 서비스 재시작
root@com1:/home# systemctl restart nfs-kernel-server
root@com1:/home# systemctl restart portmap
5. client nfs-common 설치
root@control:/home# apt install nfs-common
root@control:/home# apt install nfs-common Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: keyutils libnfsidmap2 libtirpc1 rpcbind Suggested packages: watchdog The following NEW packages will be installed: keyutils libnfsidmap2 libtirpc1 nfs-common rpcbind 0 upgraded, 5 newly installed, 0 to remove and 12 not upgraded. Need to get 379 kB of archives. After this operation, 1,386 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libnfsidmap2 amd64 0.25-5 [32.2 kB] Get:2 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libtirpc1 amd64 0.2.5-1 [75.6 kB]
6. client nfs mount
root@control:/home# mount -t nfs 192.168.9.51:/home/nfs /home/mount
root@control:/home# mount -t nfs 192.168.9.51:/home/nfs /home/mount root@control:/home# df Filesystem 1K-blocks Used Available Use% Mounted on udev 4050732 0 4050732 0% /dev tmpfs 813984 83084 730900 11% /run /dev/mapper/manager--vg-root 1914013084 3518280 1813245524 1% / tmpfs 4069908 0 4069908 0% /dev/shm tmpfs 5120 0 5120 0% /run/lock tmpfs 4069908 0 4069908 0% /sys/fs/cgroup /dev/sda1 482922 107643 350345 24% /boot tmpfs 813984 0 813984 0% /run/user/1000 tmpfs 813984 0 813984 0% /run/user/0 192.168.9.51:/home/nfs 927811584 2945024 877713408 1% /home/mount
7. client fstab 등록
root@control:/home# vi /etc/fstab # /etc/fstab: static file system information. # # Use "blkid" to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # /dev/mapper/manager--vg-root / ext4 errors=remount-ro 0 1 # /boot was on /dev/sda1 during installation UUID=638e2fc0-f89f-4ca2-9a6a-972d110c4d34 /boot ext2 defaults 0 2 /dev/mapper/manager--vg-swap_1 none swap sw 0 0 192.168.9.51:/home/nfs /home/mount nfs defaults 0 0
root@control:/home# mount -a root@control:/home# df Filesystem 1K-blocks Used Available Use% Mounted on udev 4050732 0 4050732 0% /dev tmpfs 813984 83084 730900 11% /run /dev/mapper/manager--vg-root 1914013084 3518376 1813245428 1% / tmpfs 4069908 0 4069908 0% /dev/shm tmpfs 5120 0 5120 0% /run/lock tmpfs 4069908 0 4069908 0% /sys/fs/cgroup /dev/sda1 482922 107643 350345 24% /boot tmpfs 813984 0 813984 0% /run/user/1000 tmpfs 813984 0 813984 0% /run/user/0 192.168.9.51:/home/nfs 927811584 2945024 877713408 1% /home/mount
|