NFS: Difference between revisions
m Text replacement - "Category:Linux{{Navbox Linux}}" to "{{Navbox Linux}}Category:Linux" |
m Formatting and imported WP content from http://leo.steamr.com/2011/02/fcntl-failed-no-locks-available/ |
||
| Line 1: | Line 1: | ||
== FreeBSD == | == FreeBSD == | ||
To set a FreeBSD machine up as a NFS server, add the following lines to {{code|/etc/rc.conf}} | To set a FreeBSD machine up as a NFS server, add the following lines to {{code|/etc/rc.conf}} | ||
{{highlight|lang=text|code= | |||
mountd_enable="YES" | mountd_enable="YES" | ||
nfs_server_enable="YES" | nfs_server_enable="YES" | ||
| Line 10: | Line 9: | ||
rpc_statd_enable="YES" | rpc_statd_enable="YES" | ||
mountd_flags="-r" | mountd_flags="-r" | ||
}} | |||
Since {{code|/storage}} is a single mount, you will need to define the same directories exactly the same for all the different permissions you want to define in {{code|/etc/exports}}. For example: | Since {{code|/storage}} is a single mount, you will need to define the same directories exactly the same for all the different permissions you want to define in {{code|/etc/exports}}. For example: | ||
{{highlight|lang=text|code= | |||
/storage/downloads /storage/backups/esxi -ro -network 10.1.1.0 -mask 255.255.255.0 | /storage/downloads /storage/backups/esxi -ro -network 10.1.1.0 -mask 255.255.255.0 | ||
/storage/downloads /storage/backups/esxi -maproot=root -network 10.1.1.2 -mask 255.255.255.255 | /storage/downloads /storage/backups/esxi -maproot=root -network 10.1.1.2 -mask 255.255.255.255 | ||
}} | |||
It would be '''invalid''' if the second line had only {{code|/storage/downloads}} as it will cause the first entry to be ignored by the parser. | It would be '''invalid''' if the second line had only {{code|/storage/downloads}} as it will cause the first entry to be ignored by the parser. | ||
| Line 23: | Line 22: | ||
To apply your changes, restart {{code|mountd}}. | To apply your changes, restart {{code|mountd}}. | ||
{{highlight|lang=text|code= | |||
service mountd restart | # service mountd restart | ||
}} | |||
{{code|showmount}} should show both exports: | {{code|showmount}} should show both exports: | ||
{{highlight|lang=text|code= | |||
showmount -e | # showmount -e | ||
Exports list on localhost: | |||
/storage/downloads 10.1.1.0 10.1.1.2 | |||
/storage/backups/esxi 10.1.1.0 10.1.1.2 | |||
}} | |||
== Linux == | == Linux == | ||
=== Firewall === | === Firewall === | ||
To use NFS, ensure the firewall is configured so that NFS, mountd, and RPC Bind can communicate. | |||
{{highlight|lang=terminal|code= | {{highlight|lang=terminal|code= | ||
# firewall-cmd --permanent --add-service=nfs | # firewall-cmd --permanent --add-service=nfs | ||
| Line 49: | Line 49: | ||
* See: http://dfusion.com.au/wiki/tiki-index.php?page=Why+NFSv4+UID+mapping+breaks+with+AUTH_UNIX | * See: http://dfusion.com.au/wiki/tiki-index.php?page=Why+NFSv4+UID+mapping+breaks+with+AUTH_UNIX | ||
=== | == Troubleshooting == | ||
=== {{code|writing fd to kernel failed: errno 111}} === | |||
If you get kernel errors similar to: | |||
{{highlight|lang=text|code= | |||
rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused) | |||
}} | |||
You need to start the {{code|rpc.bind}} service. | |||
{{highlight|lang=text|code= | |||
# /etc/init.d/rpcbind start | |||
}} | |||
=== fcntl() failed - No locks available === | |||
While attempting to get Dovecot with LDAP authentication working, I've ran into the following error: | |||
{{highlight|lang=text|code= | |||
dovecot: Feb 22 22:43:02 Error: IMAP(leo): fcntl() failed with file /home/leo/Maildir/dovecot.index.log: No locks available | |||
dovecot: Feb 22 22:43:02 Error: IMAP(leo): mail_index_wait_lock_fd() failed with file /home/leo/Maildir/dovecot.index.log: No locks available | |||
}} | |||
The /home directory is a automounted NFS share from a remote server. To resolve this issue, ensure that nfslock is running on both the server and client machine. | |||
[[Category:FreeBSD]] | [[Category:FreeBSD]] | ||
{{Navbox Linux}}[[Category:Linux]] | {{Navbox Linux}}[[Category:Linux]] | ||
{{Navbox Services}} | {{Navbox Services}} | ||
Revision as of 03:22, 12 September 2019
FreeBSD
To set a FreeBSD machine up as a NFS server, add the following lines to /etc/rc.conf
mountd_enable="YES"
nfs_server_enable="YES"
rpcbind_enable="YES"
rpc_lockd_enable="YES"
rpc_statd_enable="YES"
mountd_flags="-r"
Since /storage is a single mount, you will need to define the same directories exactly the same for all the different permissions you want to define in /etc/exports. For example:
/storage/downloads /storage/backups/esxi -ro -network 10.1.1.0 -mask 255.255.255.0
/storage/downloads /storage/backups/esxi -maproot=root -network 10.1.1.2 -mask 255.255.255.255
It would be invalid if the second line had only /storage/downloads as it will cause the first entry to be ignored by the parser.
To apply your changes, restart mountd.
# service mountd restart
showmount should show both exports:
# showmount -e
Exports list on localhost:
/storage/downloads 10.1.1.0 10.1.1.2
/storage/backups/esxi 10.1.1.0 10.1.1.2
Linux
Firewall
To use NFS, ensure the firewall is configured so that NFS, mountd, and RPC Bind can communicate.
# firewall-cmd --permanent --add-service=nfs
# firewall-cmd --permanent --add-service=mountd
# firewall-cmd --permanent --add-service=rpc-bind
# firewall-cmd --reload
NFSv4 ID Mapping
Troubleshooting
writing fd to kernel failed: errno 111
If you get kernel errors similar to:
rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused)
You need to start the rpc.bind service.
# /etc/init.d/rpcbind start
fcntl() failed - No locks available
While attempting to get Dovecot with LDAP authentication working, I've ran into the following error:
dovecot: Feb 22 22:43:02 Error: IMAP(leo): fcntl() failed with file /home/leo/Maildir/dovecot.index.log: No locks available
dovecot: Feb 22 22:43:02 Error: IMAP(leo): mail_index_wait_lock_fd() failed with file /home/leo/Maildir/dovecot.index.log: No locks available
The /home directory is a automounted NFS share from a remote server. To resolve this issue, ensure that nfslock is running on both the server and client machine.
| ||||||