Ubuntu 22.04 nfs-kernel-server troubleshooting
발단
임베디드에서 필수적이지만 tftp 와 함께 말썽 일이키는 투탑 nfs-kernel server
어째 tftp 는 쉽게 넘어가나 했더니 nfs가 안되네...
기록을 남기고자하는 목적으로 블로깅
전개
nfs-kernel-server 설치하고
$ sudo apt install nfs-kernel-server
/etc/exports 에 설정 넣고
/home/username/work/nfs 192.168.0/24(rw,no_root_squash,no_all_squash,async,no_subtree_check)
nfs-kernel-server 실행
$ sudo service nfs-kernel-server restart
nfs-common 설치해서 로컬에서 nfs mount 확인
$ sudo apt install nfs-common
$ mkdir mnt
$ sudo mount <ipaddr>:<host_directory> mnt/
$ ls mnt
잘 되네
위기
[ 4.407126] IP-Config: Complete:
[ 4.410342] device=eth0, hwaddr=00:03:22:81:81:ab, ipaddr=192.168.0.208, mask=255.255.0.0, gw=192.168.0.1
[ 4.419981] host=192.168.0.208, domain=, nis-domain=(none)
[ 4.425795] bootserver=255.255.255.255, rootserver=192.168.0.202, rootpath=
절정
NFSv4
$ sudo mount -t nfs4 <ipaddr>:<host_directory> mnt/mount.nfs4: mounting <ipaddr>:<host_directory> failed, reason given by server: No such file or directory
뭐야 안되네..
타겟 호스트 커널 설정에 nfsv4가 들어가있어서 되면 괜찮겠는데....
CONFIG_NFS_V4=y
다시 NFSv3
sudo systemctl start nfs-kernel-server.service
$ sudo exportfs -a$ sudo exportfs -v # 설정 확인
$ sudo mount <ipaddr>:<host_directory> mnt/
IP-Config: Complete:device=eth0, hwaddr=00:03:22:81:81:ab, ipaddr=192.168.0.208, mask=255.255.0.0, gw=192.168.0.1host=192.168.0.208, domain=, nis-domain=(none)bootserver=255.255.255.255, rootserver=192.168.0.202, rootpath=
/etc/exports 옵션 변경
(rw,sync,no_subtree_check)
(rw,no_root_squash,no_all_squash,async,no_subtree_check)
(rw,async,no_subtree_check)
U-Boot nfsboot 옵션 변경
$ sudo mount -t nfs -o vers=2 <ipaddr>:<host_directory> mnt/mount.nfs: requested NFS version or transport protocol is not supported
안됨
vers=3 설정
안됨
nfsvers=4 설정
안됨
nfsvers=3 설정
안됨
$ sudo cat /proc/fs/nfsd/versions+3 +4 +4.1 +4.2
Documentation/filesystems/nfs/nfsroot.txtnfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]If the `nfsroot' parameter is NOT given on the command line,the default "/tftpboot/%s" will be used.<server-ip> Specifies the IP address of the NFS server.The default address is determined by the `ip' parameter(see below). This parameter allows the use of differentservers for IP autoconfiguration and NFS.<root-dir> Name of the directory on the server to mount as root.If there is a "%s" token in the string, it will bereplaced by the ASCII-representation of the client'sIP address.<nfs-options> Standard NFS options. All options are separated by commas.The following defaults are used:port = as given by server portmap daemonrsize = 4096wsize = 4096timeo = 7retrans = 3acregmin = 3acregmax = 60acdirmin = 30acdirmax = 60flags = hard, nointr, noposix, cto, ac
NFS root mounts are handled by nfsmount which is part of the klibc-utils package. nfsmount only accepts integers for the 'vers' argument. And only values 2 and 3 are valid:$ ./usr/bin/nfsmount -o vers=4.14.1: invalid value for vers$ ./usr/bin/nfsmount -o vers=4./usr/bin/nfsmount: bad NFS version '4'$ ./usr/bin/nfsmount -o vers=3./usr/bin/nfsmount: need a pathThe kernel does support NFSv4:./lib/modules/5.13.0-1011-raspi/kernel/fs/nfs/nfsv4.ko
외부서버에서 접속 시도
$ sudo mount -vvvv <ipaddr>:<host_directory> mnt/mount.nfs: access denied by server while mounting 10.0.125.202:/home2/sjpark/work/nfs/loki
$ sudo ufw status상태: 비활성꺼져있음
$ sudo ufw allow from 192.168.0.0/24 to any port nfs[sudo] 암호:존재하는 규칙을 추가하는 걸 건너뜁니다
다시 nfsv4
/home2/username/work/nfs 192.168.0.0/16(fsid=0,rw,sync,no_root_squash)/home2/username/work/nfs/target 192.168.0.0/16(rw,sync,no_root_squash)
sudo mount -t nfs -vvvv 192.168.125.202:/home2/username/work/nfs/target mnt/mount.nfs: timeout set for Thu Jul 11 02:08:03 2024mount.nfs: trying text-based options 'vers=4.2,addr=192.168.125.202,clientaddr=192.168.121.9'mount.nfs: mount(2): No such file or directorymount.nfs: trying text-based options 'addr=192.168.125.202'mount.nfs: prog 100003, trying vers=3, prot=6mount.nfs: trying 192.168.125.202 prog 100003 vers 3 prot TCP port 2049mount.nfs: prog 100005, trying vers=3, prot=17mount.nfs: trying 192.168.125.202 prog 100005 vers 3 prot UDP port 54122
댓글
댓글 쓰기