7

Is there maximum numbers for file system mounts that Linux can handle? Is there differences between distros?

  • Possible duplicate of [Mounting of few tens of thousands of FS](http://serverfault.com/questions/421364/mounting-of-few-tens-of-thousands-of-fs) – phuclv Mar 17 '17 at 11:15

3 Answers3

5

Linux can handle 1000s of mounts, in fact I have seen 12000 simultaneous automounts happen on SL7.3 (based on centos). However, things get very slow for users as applications try to process these mounts and umounts. SL7.4 can start kicking users out of xdm.

Andrewuwe
  • 51
  • 1
  • 4
4

There is a cap since Linux v4.9, the default value of the cap is 100,000.

https://github.com/torvalds/linux/commit/d29216842a85

I believe one of the problems if you accidentally create thousands and thousands of mounts, is that they can take a very long time to unmount.

The CVE mentions that once you have two many mounts, certain operations cane "cause a deadlock for the whole system." Memory consumption was also mentioned as a concern.

sourcejedi
  • 1,100
  • 10
  • 20
1

Most distros should be the same, because they all run fundamentally the same kernel. I'm not aware of a specific limit to the number of mounts, but I've seen several hundred at once, which I thought was bordering on the insane (but that's automounting for you).

womble
  • 96,255
  • 29
  • 175
  • 230
  • 1
    Ok. What about tens of thousands of mounts? Don't ask me why but let's just assume that I need to mount 10000 volumes, is this technically possible? –  Jan 14 '10 at 09:36
  • 4
    I'm sorry, but "I need to mount 10,000 partitions" sounds like it's *screaming* for a different solution to whatever problem you think you're solving with all those mounts. Either that, or it's homework in disguise. – womble Jan 14 '10 at 09:55
  • Should work, but for future administrator's sake, find another way of doing it. – Andrew McGregor Jan 14 '10 at 11:55
  • 2
    Careful with statements like "you should NEVER do...". ;) We handle hundreds of large files (>20GB) containing frames which contain packets. We need to be able to extract data at frame level and at packet level according to predetermined criteria. Using e.g. the fuse filesystem to take the raw frame stream and show a virtual folder with different kinds of files within it seems like a great way to radically reduce disk space use, improve read and write speed and reduce resource load. If that means that we would have to have hundreds of mount points 1 per .bin file), I'd say "fine". – Tomislav Nakic-Alfirevic Mar 06 '13 at 13:34
  • @TomislavNakic-Alfirevic: I don't see anywhere I said "you should NEVER do"... at any rate, you still don't *have* to have hundreds or thousands of mounts -- your FUSE filesystem could be a single filesystem that was capable of handling many packets. That would make deployment easier, too, because you could add a file to your pseudo-filesystem by just copying it into a certain location, rather than having to fire up another FUSE process. – womble Mar 08 '13 at 05:34
  • 1
    I'd like to create lots of chroots, each of which will contain several other directories bind-mounted inside... I don't expect it to hit 10,000 mounts, but theoretically there might be up to 1000 from what I can see. So it really would be interesting to know what the limit is. Is it a system-wide limit, or does it maybe depend on the parent filesystem, or is it basically only limited by available memory? – oliver May 26 '14 at 14:30
  • @oliver I still fall back on "you're probably doing it wrong" wanting to create that many chroots simultaneously, but at this point in time I'd probably ask a new question rather than try to resurrect this one. Alternately, since the source is right there, you could take a look yourself -- or just try to create lots and lots of bind mounts and see if/when it breaks. – womble May 30 '14 at 09:26