Operating System - HP-UX
1822895 Members
3398 Online
109645 Solutions
New Discussion юеВ

Filename & Filesystem name lengths in NFS

 
Chern Jian Leaw
Regular Advisor

Filename & Filesystem name lengths in NFS

HI,
Is there a way which I can check what is the maximum length of a file-name and a filesystem name in NFS?

Also, is there a way to check the NFS version which I'm currently running? I'm working on a HP11 machine.

Could anyone help me out?

Thanks.
5 REPLIES 5
Michael Tully
Honored Contributor

Re: Filename & Filesystem name lengths in NFS

The maximum length of a file is generally considered to be 255 characters. On older systems where 'hfs' filesystems were used, the maximum was 14. (you can use 'convertfs' to fix it)

Using this example you can check.

# getconf NAME_MAX /myfilesystem (this will also work for NFS mount points.)

Another way to get this information is by:

# fstyp -v /dev/mygrp/lvolX (but this must be run on the system that is exporting the file system.

As far as the "nfs" version goes, well you could look at the version number of the 'nfsd' binary.

# which nfsd
/usr/sbin/nfsd
# strings /usr/sbin/nfsd

Another way is to check the patch level.

# swlist -l patch | grep -i NFS

HTH
Michael
Anyone for a Mutiny ?
Chern Jian Leaw
Regular Advisor

Re: Filename & Filesystem name lengths in NFS

Michael,

When using the following parameters in getconf, if get the following results:

#getconf NAME_MAX /myfilesystem
255

#getconf CHAR_MAX /myfilesystem
127

May I know what is the difference in NAME_MAX and the CHAR_MAX parameters? My understanding is that the filesystem or file name length should be based on the number of characters.Please correct me if I'm wrong.

Regarding the NFS version, I get the following output when I did:

#strings /usr/etc/nfsd

I included the output from #strings /usr/etc/nfsd. I was if you confirm if the NFS version is version is 1.13 or 1.8.

Also, from the attachment, could you kindly explain what is the cause of the message and what does it mean? :
"nfsd: can't fork"
"Usage: nfsd [-a | -p ....]"
James Murtagh
Honored Contributor

Re: Filename & Filesystem name lengths in NFS

Hi,

If you read the man page for getconf carefully, NAME_MAX and CHAR_MAX are in different contexts. A quote from the man page :

The getconf command provides an interface to the confstr(3C),
pathconf(2), and sysconf(2) library routines and system calls.

NAME_MAX relates to what Michael said, and it looks like CHAR_MAX is the signed maximum of the char type in the C language.

To illustrate :

# getconf NAME_MAX
Usage: getconf parameter_name [pathname]
# getconf CHAR_MAX
127
# getconf CHAR_MAX put_anything_here
127

To find out what versions of nfs you are using, use rpcinfo or nfsstat :

# rpcinfo -p|grep nfs

100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs

So you can see versions 2 & 3 can be used. Also see the man page for nfsstat.

The ouput from the strings command is just conditions programmed into the daemon in case an execption occurs, nothing to worry about.

Regards,

James.

Michael Tully
Honored Contributor

Re: Filename & Filesystem name lengths in NFS

Hi,

Have a look at the man page 'limits' that explain these two different options.

CHAR_MAX = Minimum integer value of a character
NAME_MAX = Maximum number of bytes in a path name component.

The output of the 'nfsd' program are usages that are coded into the binary.

Have look at the 'nfsstat' man page.

e.g.
# nfstat -s

Michael
Anyone for a Mutiny ?
Keith Clark
Valued Contributor

Re: Filename & Filesystem name lengths in NFS

Just keep in mind, using long directory and filenames could create performance issues on a NFS server. A single long directory name can cause name cache (dnlc) misses, which means directory (read) access for every inode below it in the file system.

Check your header files in /usr/conf/h/dnlc.h for the maximum length in bytes that the O/S will cache. On 11.00 it is 39 - 1 (for terminating null byte) = 38:

#define NC_NAMLEN 39 /* maximum name segment length we bother with*/

If you keep the names of frequently accessed directories below 38 charactors, you can improve performance by avoiding the directory structure read to determine a file's inode. See the "What's in a name?" section of Ixora News at http://www.ixora.com.au/newsletter/2000_12.htm

You can check the DNLC hit rate on the last page of the Glance disk report.

Keith