Mounting of few tens of thousands of FS [closed]

I need to provide the ability to create/read/write/delete files and set quotas for a large number of users of a web-service. These users do not exist as Linux users so I can't apply quotas. The creation of real users just to perform quotas seems like a bad idea. Therefore, I decided to create a per-user file and mount it as a filesystem.

  1. What is the consequence of mounting of several tens of thousands of FS?
  2. Is there a limit on the total number of mounted FS?

First off, mounting that many filesystems seems like a really bad idea - there must be a better solution to whatever problem you have?

Anyway, to answer your second question: an answer on a previous serverfault question seems to indicate that the limit is about 1 million mount points (2^20) per file system type for recent kernels, and you can mount at most 256 different types of filesystem.

For older kernels (pre 2.6) the limit is 256 mount points per filesystem.


Edit in response to the comments, I propose the following alternative solution:

Use XFS, which allows you to use project quota, a form of directory quota.

Create a separate XFS file system which will hold all webservice user data. Mount it at e.g. /mnt/myWebService. Then, for each webservice user, create a project directory (eg /mnt/myWebService/username1 etc) and set quota accordingly.

For instructions on how to set up project directories and quota, you can for example check out this blog entry or the RHEL XFS Quota Management page


Note that you don't have to create users (as in add them to /etc/passwd or any user database you want), you can set ownership of a file to any uid without it. Just make sure those uids don't overlap with local (or remote) users that may run processes on that server.

However, to be able to change the owner of a file, you need superuser privileges, which may be problematic for your web application.

Note that when you're using ZFS, you get one mount point for every snapshot, and it's not uncommon to have thousands of them, which isn't too much of a problem.


There's no need to create a zillion filesystems for this.

The easy way to do this is to create a directory for each user (which you already would have to do) and then check how much space the files in the directory use up each time a user tries to upload something. If the upload would cause them to exceed their limit, reject the upload. This is the way every other web application in the known universe does it.

P.S. You've scattered the details of what you're doing throughout several comments; you should add them to the question instead so that people can find them (and perhaps reverse your downvotes).