zfs directory listing

Ivan Voras ivoras at freebsd.org
Thu Feb 17 00:56:02 UTC 2011


On 16/02/2011 23:52, Andrew Thompson wrote:
> Hi,
>
>
> I have a zfs file system on 8.1-RELEASE amd64 which as a large number
> of files in /var/spool/mqueue. loader.conf has vfs.zfs.arc_max=2G for
> an 8G box.

> mqueue has a link count of 522824. I can not list the contents of this
> directory, when I do the number of read IOPS sits>  100 and it will
> never complete

Your problem is probably not FreeBSD-specific and possibly not even 
ZFS-specific. That is a fairly large number of files in a directory for 
any file system; The rule of thumb is usually to start sharding as soon 
as the number of files gets even two orders of magnitude lower than what 
you have there.

As others said, try "cd /var/spool/mqueue && find ." - the find utility 
just reads the directory, it doesn't try to gather other metadata which 
"ls" uses and is usually one of the rare utilities which can work with 
gigantic directories (usually in the form "find . -delete" :) ).

The reason for this is that filenames and file metadata are separate 
objects on the drives and the drives need to seek between them to get 
both if they are not cached.




More information about the freebsd-fs mailing list