disk problem(s)

Polytropon freebsd at edvax.de
Sat Jan 14 08:22:39 UTC 2012

On Sat, 14 Jan 2012 08:45:20 +0100, Bernt Hansson wrote:
> Hello list!
>   7.3-RELEASE FreeBSD 7.3-RELEASE #0: Sun Mar 21 06:15:01 UTC 2010 
> root at walker.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
> Whenever a program tries to make a directory on this slice it
> gets this error

It's a partition, not a slice. Partitions carry
file systems, slices carry partitions. :-)

> mkdir: spool/text/test: Too many links

So the problem seems to be related to directories, not
to "any files" (inodes) per se.

> This is the slice
> /dev/ad4s4d    202G     37G    149G    20%    /news/spool/text

The partition; ad4s4 would be the slice. :-)

> One can create a file without problems just not directories.
> Checked sysctl but don't know what to look for. A boot in the right end 
> would be helpful.

I would suggest to find out the reason, therefore
a short search though the src/ subtree reveals that
this message provided by mkdir is:

	#if defined (EMLINK)
	  ENTRY(EMLINK, "EMLINK", "Too many links"),

As the mkdir program uses the mkdir() call, we find
"man 2 mkdir" with the error description for EMLINK:

	The new directory cannot be created because
	the parent directory contains too many

How many subdirectories are there?

Could you, for example, try removing one and then
creating a new one (assumption: success), followed
by another try to create one (assumption: fail)?


The mkdir() function can be found (for UFS2) in the
file /usr/src/sys/gnu/fs/ext2fs/ext2_vnops.c at
line 1111 (sources of 8.2-STABLE i386 here). If
you examine what mkdir() does, you'll see that
the "too many links" is true when LINK_MAX is
exceeded. Per /usr/src/sys/gnu/fs/ext2fs/ext2_fs.h
we can determine that

	#define EXT2_LINK_MAX           32000

is defined. Can you check if 32000 is the amount
of directories created?

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list