nfsadminnfsadmin

适用于: Windows Server (半年通道) ,Windows Server 2019,Windows Server 2016,Windows Server 2012 R2,Windows Server 2012Applies to: Windows Server (Semi-Annual Channel), Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012

一种命令行实用工具,用于在运行 Microsoft Services for 网络文件系统 (NFS) 的本地或远程计算机上管理 NFS 服务器或客户端 NFS 服务器。A command-line utility that administers Server for NFS or Client for NFS on the local or remote computer running Microsoft Services for Network File System (NFS). 使用不带参数的 nfsadmin 服务器将显示当前的 NFS 服务器配置设置,nfsadmin 客户端将显示当前的 NFS 客户端配置设置。Used without parameters, nfsadmin server displays the current Server for NFS configuration settings and nfsadmin client displays the current Client for NFS configuration settings.

语法Syntax

nfsadmin server [computername] [-u Username [-p Password]] -l
nfsadmin server [computername] [-u Username [-p Password]] -r {client | all}
nfsadmin server [computername] [-u Username [-p Password]] {start | stop}
nfsadmin server [computername] [-u Username [-p Password]] config option[...]
nfsadmin server [computername] [-u Username [-p Password]] creategroup <name>
nfsadmin server [computername] [-u Username [-p Password]] listgroups
nfsadmin server [computername] [-u Username [-p Password]] deletegroup <name>
nfsadmin server [computername] [-u Username [-p Password]] renamegroup <oldname> <newname>
nfsadmin server [computername] [-u Username [-p Password]] addmembers <hostname>[...]
nfsadmin server [computername] [-u Username [-p Password]] listmembers
nfsadmin server [computername] [-u Username [-p Password]] deletemembers <hostname><groupname>[...]
nfsadmin client [computername] [-u Username [-p Password]] {start | stop}
nfsadmin client [computername] [-u Username [-p Password]] config option[...]

常规参数General Parameters

参数Parameter 说明Description
computernamecomputername 指定要管理的远程计算机。Specifies the remote computer you want to administer. 你可以使用 Windows Internet 名称服务指定计算机 (WINS) 名称或域名系统 (DNS) 名称或 Internet 协议 (IP) 地址。You can specify the computer using a Windows Internet Name Service (WINS) name or a Domain Name System (DNS) name, or by Internet Protocol (IP) address.
-u 用户名-u Username 指定要使用其凭据的用户的用户名。Specifies the user name of the user whose credentials are to be used. 可能需要以 "域 \ 用户名" 格式将域名添加到用户名。It might be necessary to add the domain name to the user name in the form domain\username.
-p 密码-p Password 指定使用 -u 选项指定的用户的密码。Specifies the password of the user specified using the -u option. 如果指定 -u 选项,但忽略 -p 选项,则系统会提示输入用户的密码。If you specify the -u option but omit the -p option, you are prompted for the user's password.
参数Parameter 说明Description
-l-l 列出客户端持有的所有锁。Lists all locks held by clients.
-r {client|all}-r {client|all} 释放由客户端持有的锁,如果所有客户端均指定了 all,则为。Releases the locks held by a client or, if all is specified, by all clients.
startstart 启动 NFS 服务器服务。Starts the Server for NFS service.
stopstop 停止 NFS 服务器服务。Stops the Server for NFS service.
configconfig 指定 NFS 服务器的常规设置。Specifies general settings for Server for NFS. 必须至少提供以下选项之一和 config 命令参数:You must supply at least one of the following options with the config command argument:
  • **mapsvr = <server> **-将服务器设置为 NFS 服务器的用户名映射服务器。mapsvr=<server> - Sets server as the User Name Mapping server for Server for NFS. 尽管此选项仍可与以前版本的兼容性一起使用,但你应改为使用 sfuadmin 实用程序。Although this option continues to be supported for compatibility with previous versions, you should use the sfuadmin utility instead.
  • **auditlocation = {eventlog|file|both|none} **-指定是否审核事件以及记录事件的位置。auditlocation={eventlog|file|both|none} - Specifies whether events will be audited and where the events will be recorded. 需要以下参数之一:One of the following arguments is required:
    • eventlog -指定将仅在事件查看器应用程序日志中记录审核的事件。eventlog - Specifies that audited events will be recorded only in the Event Viewer application log.
    • 文件 -指定将仅在指定的文件中记录已审核的事件 config fnamefile - Specifies that audited events will be recorded only in the file specified by config fname.
    • 两者 -指定审核事件将记录在事件查看器应用程序日志以及由指定的文件中 config fnameboth - Specifies that audited events will be recorded in the Event Viewer application log as well as the file specified by config fname.
    • -指定不审核事件。none - Specifies that events aren't audited.
  • **fname = <file> **-将文件指定的文件设置为审核文件。fname=<file> - Sets the file specified by file as the audit file. 默认值为 %sfudir%\log \ nfssvrThe default is %sfudir%\log\nfssvr.log.
  • **fsize = <size> **-将大小设置为审核文件的最大大小(mb)。fsize=<size> - Sets size as the maximum size in megabytes of the audit file. 默认的最大大小为 7 MBThe default maximum size is 7 MB.
  • audit=[+|-]mount [+|-]read [+|-]write [+|-]create [+|-]delete [+|-]locking [+|-]all -指定要记录的事件。audit=[+|-]mount [+|-]read [+|-]write [+|-]create [+|-]delete [+|-]locking [+|-]all - Specifies the events to be logged. 若要开始记录事件,请在事件名称之前键入一个加号 (+) ; 若要停止记录事件,请在 - 事件名称之前键入减号 () 。To start logging an event, type a plus sign (+) before the event name; to stop logging an event, type a minus sign (-) before the event name. 如果省略符号,则假定为 + 符号。If the sign is omitted, the + sign is assumed. 不要将 所有 事件与任何其他事件名称一起使用。Don't use all with any other event name.
  • **lockperiod = <seconds> **-指定在到 NFS 服务器的连接丢失然后重新建立,或在 NFS 服务器服务重新启动后,NFS 服务器等待回收锁的秒数。lockperiod=<seconds> - Specifies the number of seconds that Server for NFS will wait to reclaim locks after a connection to Server for NFS has been lost and then reestablished or after the Server for NFS service has been restarted.
  • **portmapprotocol = {TCP|UDP|TCP+UDP} **-指定 Portmap 支持的传输协议。portmapprotocol={TCP|UDP|TCP+UDP} - Specifies which transport protocols Portmap supports. 默认设置为 TCP + UDPThe default setting is TCP+UDP.
  • **mountprotocol = {TCP|UDP|TCP+UDP} **-指定装载支持的传输协议。mountprotocol={TCP|UDP|TCP+UDP} - Specifies which transport protocols mount supports. 默认设置为 TCP + UDPThe default setting is TCP+UDP.
  • **nfsprotocol = {TCP|UDP|TCP+UDP} **-指定网络文件系统 (NFS) 支持的传输协议。nfsprotocol={TCP|UDP|TCP+UDP} - Specifies which transport protocols Network File System (NFS) supports. 默认设置为 TCP + UDPThe default setting is TCP+UDP
  • **nlmprotocol = {TCP|UDP|TCP+UDP} **-指定网络锁定管理器 (NLM) 支持哪种传输协议。nlmprotocol={TCP|UDP|TCP+UDP} - Specifies which transport protocols Network Lock Manager (NLM) supports. 默认设置为 TCP + UDPThe default setting is TCP+UDP.
  • **nsmprotocol = {TCP|UDP|TCP+UDP} **-指定网络状态管理器 (NSM) 支持的传输协议。nsmprotocol={TCP|UDP|TCP+UDP} - Specifies which transport protocols Network Status Manager (NSM) supports. 默认设置为 TCP + UDPThe default setting is TCP+UDP.
  • **enableV3 = {yes|no} **-指定是否将支持 NFS 版本3协议。enableV3={yes|no} - Specifies whether NFS version 3 protocols will be supported. 默认设置为 "是"The default setting is yes.
  • **renewauth = {yes|no} **-指定在 config renewauthinterval 指定的时间段后是否需要重新进行身份验证的客户端连接。renewauth={yes|no} - Specifies whether client connections will be required to be reauthenticated after the period specified by config renewauthinterval. 默认设置为 " "。The default setting is no.
  • **renewauthinterval = <seconds> **-如果 config renewauth 设置为 "是",则指定在强制重新进行身份验证之前经过的秒数。renewauthinterval=<seconds> - Specifies the number of seconds that elapse before a client is forced to be reauthenticated if config renewauth is set to yes. 默认值为 600 秒The default value is 600 seconds.
  • **dircache = <size> **-指定目录缓存的大小(kb)。dircache=<size> - Specifies the size in kilobytes of the directory cache. 指定为 size 的数字必须是4到128之间的4的倍数。The number specified as size must be a multiple of 4 between 4 and 128. 默认目录缓存大小为 128 KBThe default directory cache size is 128 KB.
  • **translationfile = <file> **-指定一个文件,该文件包含用于在从基于 Windows 的到基于 UNIX 的文件系统移动文件时替换文件名称中的字符的映射信息。translationfile=<file> - Specifies a file containing mapping information for replacing characters in the names of files when moving them from Windows-based to UNIX-based file systems. 如果未指定文件,则将禁用文件名字符转换。If file is not specified, then file name character translation is disabled. 如果 translationfile 的值已更改,则必须重新启动服务器才能使更改生效。If the value of translationfile is changed, you must restart the server for the change to take effect.
  • **dotfileshidden = {yes|no} **-指定名称以句点开头的文件是否 (。 ) 在 Windows 文件系统中标记为隐藏,因而对 NFS 客户端隐藏。dotfileshidden={yes|no} - Specifies whether files with names beginning with a period (.) are marked as hidden in the Windows file system, and consequently hidden from NFS clients. 默认设置为 " "。The default setting is no.
  • **casesensitivelookups = {yes|no} **-指定目录查找是否区分大小写 (需要完全匹配字符大小写) 。casesensitivelookups={yes|no} - Specifies whether directory lookups are case sensitive (require exact matching of character case).

    还必须禁用 Windows 内核不区分大小写,以支持区分大小写的文件名。You must also disable Windows kernel case-insensitivity to support case-sensitive file names. 若要支持区分大小写,请将注册表项的 DWord 值更改 HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel0To support case-sensitivity, change the DWord value of the registry key, HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel, to 0.

  • **ntfscase = {lower|upper|preserve} **-指定 NTFS 文件系统中文件名称的大小写是否以小写、大写或存储在目录中的形式返回。ntfscase={lower|upper|preserve} - Specifies whether the case of characters in the names of files in the NTFS file system will be returned in lowercase, uppercase, or in the form stored in the directory. 默认设置为 " 保留"。The default setting is preserve. 如果 casesensitivelookups 设置为 "是",则无法更改此设置。This setting can't be changed if casesensitivelookups is set to yes.
creategroup <name>creategroup <name> 创建新的客户端组,并为其指定名称。Creates a new client group, giving it the specified name.
listgroupslistgroups 显示所有客户端组的名称。Displays the names of all client groups.
deletegroup <name>deletegroup <name> 删除由名称指定的客户端组。Removes the client group specified by name.
renamegroup <oldname>``<newname>renamegroup <oldname> <newname> oldname 指定的客户端组的名称更改为 newnameChanges the name of the client group specified by oldname to newname.
addmembers <hostname>[...]addmembers <hostname>[...] 主机 添加到按 名称指定的客户端组。Adds a host to the client group specified by name.
listmembers <name>listmembers <name> 列出由 名称指定的客户端组中的主机。Lists the host computers in the client group specified by name.
deletemembers <hostname><groupname>[...]deletemembers <hostname><groupname>[...] 指定的客户端组中删除主机指定的客户端。Removes the client specified by host from the client group specified by group.
参数Parameter 说明Description
startstart 启动 NFS 客户端服务。Starts the Client for NFS service.
stopstop 停止 NFS 客户端服务。Stops the Client for NFS service.
configconfig 指定 NFS 客户端的常规设置。Specifies general settings for Client for NFS. 必须至少提供以下选项之一和 config 命令参数:You must supply at least one of the following options with the config command argument:
  • **fileaccess = <mode> **-指定在网络文件系统 (NFS) 服务器上创建的文件的默认权限模式。fileaccess=<mode> - Specifies the default permission mode for files created on Network File System (NFS) servers. Mode参数由三位数字组成,其中0到 7 (包含) ,表示授予用户、组和其他权限的默认权限。The mode argument consists of a three digit number, from 0 to 7 (inclusive), which represent the default permissions granted the user, group, and others. 这些数字转换为 UNIX 样式权限,如下所示: 0 = 无; *1 = x (执行) *, *2 = w (只写入) *, *3 = wx (写入和执行) *, *4 = r (只读) *, *5 = rx * (读取和执行) , *6 = rw * (读取和执行) ,6 = *rwx (读取、写入和执行) *。The digits translate to UNIX-style permissions as follows: 0=none, 1=x (execute), 2=w (write only), 3=wx (write and execute), 4=r (read only), 5=rx (read and execute), 6=rw (read and write), and 7=rwx (read, write, and execute). 例如,向 fileaccess=750 所有者授予 "读取"、"写入" 和 "执行" 权限,对组具有 "读取" 和 "执行" 权限,而对其他用户没有访问权限。For example, fileaccess=750 gives read, write, and execute permissions to the owner, read and execute permissions to the group, and no access permission to others.
  • **mapsvr = <server> **-将服务器设置为适用于 NFS 的客户端的用户名映射服务器。mapsvr=<server> - Sets server as the User Name Mapping server for Client for NFS. 尽管此选项仍可与以前版本的兼容性一起使用,但你应改为使用 sfuadmin 实用程序。Although this option continues to be supported for compatibility with previous versions, you should use the sfuadmin utility instead.
  • **mtype = {hard|soft} **-指定默认装载类型。mtype={hard|soft} - Specifies the default mount type. 对于硬装载,NFS 客户端会继续重试失败的 RPC,直到成功。For a hard mount, Client for NFS continues to retry a failed RPC until it succeeds. 对于软装载,NFS 客户端在重试后将失败返回到调用应用程序。For a soft mount, Client for NFS returns failure to the calling application after retrying the call the number of times specified by the retry option.
  • 重试 <number> =-指定尝试建立软装载连接的次数。retry=<number> - Specifies the number of times to try to make a connection for a soft mount. 此值必须介于1到10(含)之间。This value must be from 1 to 10, inclusive. 默认值为 1The default is 1.
  • **超时 = <seconds> **-指定等待连接 (远程过程调用) 的秒数。timeout=<seconds> - Specifies the number of seconds to wait for a connection (remote procedure call). 此值必须是 0.80.9或从 1 到 60的整数(包括1和)。This value must be 0.8, 0.9, or an integer from 1 to 60, inclusive. 默认值为 0.8The default is 0.8.
  • **协议 = {TCP|UDP|TCP+UDP} **-指定客户端支持的传输协议。protocol={TCP|UDP|TCP+UDP} - Specifies which transport protocols the client supports. 默认设置为 TCP + UDPThe default setting is TCP+UDP.
  • **rsize = <size> **-指定读取缓冲区的大小(以 kb 为单位)。rsize=<size> -Specifies the size, in kilobytes, of the read buffer. 此值可以是 0.5、1、2、4、8、1632This value can be 0.5, 1, 2, 4, 8, 16, or 32. 默认值为 32The default is 32.
  • **wsize = <size> **-指定写入缓冲区的大小(以 kb 为单位)。wsize=<size> - Specifies the size, in kilobytes, of the write buffer. 此值可以是 0.5、1、2、4、8、1632This value can be 0.5, 1, 2, 4, 8, 16, or 32. 默认值为 32The default is 32.
  • perf = 默认 值-将以下性能设置还原为默认值: mtyperetrytimeoutrsizewsizeperf=default - Restores the following performance settings to default values, mtype, retry, timeout, rsize, or wsize.

示例Examples

要停止 NFS 服务器或 NFS 客户端,请键入:To stop Server for NFS or Client for NFS, type:

nfsadmin server stop
nfsadmin client stop

若要启动 NFS 服务器或 NFS 客户端,请键入:To start Server for NFS or Client for NFS, type:

nfsadmin server start
nfsadmin client start

若要将 NFS 服务器设置为不区分大小写,请键入:To set Server for NFS to not be case-sensitive, type:

nfsadmin server config casesensitive=no

若要将 NFS 客户端设置为区分大小写,请键入:To set Client for NFS to be case-sensitive, type:

nfsadmin client config casesensitive=yes

若要显示 "所有 NFS 服务器" 或 "NFS 客户端" 选项,请键入:To display all the current Server for NFS or Client for NFS options, type:

nfsadmin server config
nfsadmin client config

其他参考Additional References