Centos 7의 NFS 공유는 자동으로 마운트될 수 없습니다.

Centos 7의 NFS 공유는 자동으로 마운트될 수 없습니다.

192.168.254.105:/srv/nfsshareCentos 7을 새로 설치했습니다. Centos 클라이언트에서 NFS 공유를 자동 마운트할 수 없는 것 같습니다.

그러나 공유를 수동으로 마운트하면 문제가 없습니다.

/etc/auto.master다음 줄을 제외하고는 문제를 단순화하기 위해 완전히 주석 처리되었습니다.

/-       /etc/auto.nfsshare 

/etc/auto.nfsshare 다음 줄을 포함합니다:

/tests/nfsshare       -fstype=nfs,credentials=/etc/credentials.txt    192.168.254.105:/srv/nfsshare

/etc/credentials.txt잡고 있다:

 user=user
 password=password

예상되는 동작은 ls -l /tests/nfsshare내 파일 서버에서 일부 파일을 보는 것입니다./srv/nfsshare디렉토리가 저장되었습니다.

그렇지 않습니다. 대신 아무것도 표시되지 않습니다.

다음에서 로그인sudo 저널ctl --unit=autofs.service이 메시지는 시작 시 표시됩니다(디버깅 활성화됨).

 Nov 20 00:25:38 localhost.localdomain systemd[1]: Starting Automounts filesystems on demand...
 Nov 20 00:25:38 localhost.localdomain automount[21204]: Starting automounter version 5.0.7-48.el7, master map auto.master
 Nov 20 00:25:38 localhost.localdomain automount[21204]: using kernel protocol version 5.02
 Nov 20 00:25:38 localhost.localdomain automount[21204]: lookup_nss_read_master: reading master files auto.master
 Nov 20 00:25:38 localhost.localdomain automount[21204]: parse_init: parse(sun): init gathered global options: (null)
 Nov 20 00:25:38 localhost.localdomain automount[21204]: spawn_mount: mtab link detected, passing -n to mount
 Nov 20 00:25:38 localhost.localdomain automount[21204]: spawn_umount: mtab link detected, passing -n to mount
 Nov 20 00:25:38 localhost.localdomain automount[21204]: lookup_read_master: lookup(file): read entry /-
 Nov 20 00:25:38 localhost.localdomain automount[21204]: master_do_mount: mounting /-
 Nov 20 00:25:38 localhost.localdomain automount[21204]: automount_path_to_fifo: fifo name /run/autofs.fifo--
 Nov 20 00:25:38 localhost.localdomain automount[21204]: lookup_nss_read_map: reading map file /etc/auto.nfsshare
 Nov 20 00:25:38 localhost.localdomain automount[21204]: parse_init: parse(sun): init gathered global options: (null)
 Nov 20 00:25:38 localhost.localdomain automount[21204]: spawn_mount: mtab link detected, passing -n to mount
 Nov 20 00:25:38 localhost.localdomain automount[21204]: spawn_umount: mtab link detected, passing -n to mount
 Nov 20 00:25:38 localhost.localdomain automount[21204]: mounted direct on /tests/nfsshare with timeout 300, freq 75 seconds
 Nov 20 00:25:38 localhost.localdomain automount[21204]: do_mount_autofs_direct: mounted trigger /tests/nfsshare
 Nov 20 00:25:38 localhost.localdomain automount[21204]: st_ready: st_ready(): state = 0 path /-
 Nov 20 00:25:38 localhost.localdomain systemd[1]: Started Automounts filesystems on demand.

다음을 통해 nfs 공유를 강제로 마운트하려고 할 때ls -l /test/nfsshare:

 Nov 20 00:48:05 localhost.localdomain automount[22030]: handle_packet: type = 5
 Nov 20 00:48:05 localhost.localdomain automount[22030]: handle_packet_missing_direct: token 21, name /tests/nfsshare, request pid 22057
 Nov 20 00:48:05 localhost.localdomain automount[22030]: attempting to mount entry /tests/nfsshare
 Nov 20 00:48:05 localhost.localdomain automount[22030]: lookup_mount: lookup(file): looking up /tests/nfsshare
 Nov 20 00:48:05 localhost.localdomain automount[22030]: lookup_mount: lookup(file): /tests/nfsshare -> -fstype=nfs,credentials=/etc/credenti...fsshare
 Nov 20 00:48:05 localhost.localdomain automount[22030]: parse_mount: parse(sun): expanded entry: -fstype=nfs,credentials=/etc/credentials.tx...fsshare
 Nov 20 00:48:05 localhost.localdomain automount[22030]: parse_mount: parse(sun): gathered options: fstype=nfs,credentials=/etc/credentials.txt  
 Nov 20 00:48:05 localhost.localdomain automount[22030]: [90B blob data]
 Nov 20 00:48:05 localhost.localdomain automount[22030]: dev_ioctl_send_fail: token = 21
 Nov 20 00:48:05 localhost.localdomain automount[22030]: failed to mount /tests/nfsshare
 Nov 20 00:48:05 localhost.localdomain automount[22030]: handle_packet:      type = 5
 Nov 20 00:48:05 localhost.localdomain automount[22030]: handle_packet_missing_direct: token 22, name /tests/nfsshare, request pid 22057
 Nov 20 00:48:05 localhost.localdomain automount[22030]: dev_ioctl_send_fail: token = 22

또한,ls -l /test/nfsshare실제로 오류가 발생합니다.

 ls: cannot access nfsshare/: No such file or directory

이 문제를 어떻게 해결할 수 있나요? 앞에서 언급했듯이 공유를 수동으로 마운트하면 문제가 없습니다.


편집: 요청한 대로 출력ls -la /etc/auto.nfsshare

-rw-r--r--. 1 root root 99 Nov 20 00:25 /etc/auto.nfsshare

답변1

나는 같은 문제를 가지고있다.

구성은 괜찮은데 디렉터리가 생성된 것 같은데 디렉터리가 존재하지 않습니다.

내 특정 사례의 해결책은 파일이 autofs가 읽을 수 없는 UTF-8 파일이라는 것이었습니다(그래서 로깅에 Blob 메시지가 표시되었습니다).

파일을 다시 만들고 ASCII 파일인지 확인하세요. 바꾸고 나니 모든 것이 완벽해졌습니다.

답변2

지금까지 사용자 이름/비밀번호로 보호된 NFS 공유를 본 적이 없습니다.

그럼에도 불구하고 여기에서 systemd 기능을 최대한 활용할 수 있습니다(예: /tests/nfsshare에 기본 NFS 공유를 마운트하려고 함).

192.168.254.105:/srv/nfsshare /tests/nfsshare   nfs users,_netdev,x-systemd.automount  0 0

관련 정보