7

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...

2 Answers 2

7

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.

3
  • That's too bad. I work in an environment with hundreds of thousands of users each with unique UIDs and simply running find ~homedir | wc -l would take a couple months. If I had quotas it would be simpler to track these users down. As it is, I just wait until a user with 20gajillion files causes trouble for some of our other systems (malware scanning, backups, etc). Thanks!
    – chris
    Jun 17, 2013 at 12:57
  • This is an interesting (and old) question. It makes me curious whether metadata usage counts toward quotas. If it does, that could give an implicit inode max for a user. May 20, 2019 at 10:03
  • I just noticed in ZoL 0.7.13 manual there is a userobjused property and userobjquota which might be the kind of thing @chris is looking for. Obviously this is a different ZFS implementation but might be worth revisiting what Solaris ZFS / Oracle Linux ZFS does. May 20, 2019 at 10:11
0

Setting inode quotas is possible for OpenZFS.

The zfs userspace command displays space and inode usage for all IDs.
The zfs set command can be used to set disk/inode quotas

# zfs userspace rpool/root
TYPE        NAME               USED  QUOTA  OBJUSED  OBJQUOTA
POSIX User  root              3.01G   none    78.4K      none
...

# zfs get userquota@root rpool/root
# zfs get userobjquota@root rpool/root

# zfs set userquota@user1=10G rpool/root
# zfs set userobjquota@user1=1000 rpool/root

Note that such quotas can be set also per group or project.

See the manual pages for zfsprops, zfs-userspace, zfs-set and zfs-get for more information.

The question is asked in general, so despite the solaris tag I'm answering for OpenZFS, which is the implementation which most Linux distributions use.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .