Can you set inode quotas in ZFS?

I figured out how to set block quotas in ZFS from the documentation on oracle's site.

I didn't see if / how to setup a quota on how many inodes a user gets, though. I realize that there may not be restrictions on how many inodes a ZFS filesystem has, but when my users create a directory tree 10,000 directories deep each with 300 files, it is kind of a pain in the butt to deal with.

Bonus points if you can set it in the oracle storage appliance...


Solution 1:

Short Answer

No

Long Answer

Quoting from "Chapter 1 Oracle Solaris ZFS File System (Introduction)":

All metadata is allocated dynamically, so no need exists to preallocate inodes or otherwise limit the scalability of the file system when it is first created.

...no limit exists on the number of file systems or the number of files that can be contained within a file system.

There was also a discussion of this same issue back in 2009 on the zfs-discuss mailing list.

Re: [zfs-discuss] ZFS directory and file quota

I can not find any instructions on how to set the file quota (i.e. maximum number of files per filesystem/directory) or directory quota (maximum size that files in particular directory can consume) in ZFS.

That is because it doesn't exist.

Here's another good quote from mailing list in August 2010:

Re: [zfs-discuss] File system ownership details of ZFS file system.

ZFS does not have a fixed number of inodes, so there is no way to calculate a limit, per se. ZFS uses space for metadata, so as long as you have available space, you can use it for metadata.

In another thread in 2010 there was a discussion on how to calculate the number of inodes for a ZFS filesystem based on the total space (there's also a helpful script provided).

Quoting one of the replies:

In ZFS, you will run out of inodes at the same time as you run out of space.

Possible Solution

You can, however, enforce user-level inode quotas by using UFS filesystems on ZFS zvols.

  • UFS zvols
    • Fun with zvols - UFS on a zvol
    • Taking UFS new places safely with ZFS zvols
  • UFS quotas
    • Chapter 7 Managing UFS Quotas (Tasks)