r/zfs•
leegethas

Is there a limit to the amount of ZFS filesystems?

Hi,

A have a ZFS filesystem, where I need to create individual directories for every client we have. For example:

zfs create Tank/Clients
mkdir Tank/Clients/ACME
mkdir Tank/Clients/Dharma
mkdir Tank/Clients/Momcorp
mkdir Tank/Clients/Etcetera

Instead of directories, I like to create ZFS filesystems. Like this:

zfs create Tank/Clients
zfs create Tank/Clients/ACME
zfs create Tank/Clients/Dharma
zfs create Tank/Clients/Momcorp
zfs create Tank/Clients/Etcetera

But that means I'm going to create around 1400 ZFS filesystems in Tank/Clients. And I'm not sure if this is a good idea.

Is there any limit to the amount of filesystem I can create? Or shouldn't it make any difference?

Edit: Thanks for the input everybody.

Posted Dec 10, 2019, 1:48 PM UTC · edited

714
dnabre•

Apparently the limit is 2^64 filesystems per zpool.

ZFS is designed to scale like crazy, don't worry about it.

18
mysticalfruit•

If there's a limit I've never hit it. I've got boxes with more than 100k snapshot spread across more than 9k worth of filesystems. The only thing I've run into is running "zfs list" commands just takes a really long time.

12
fryfrog•

I wonder if the new metadata special type would "solve" that?

6
thulle•

It will help greatly.

6
bjd2385•

I was going to say, they've released something to combat this ha

2
_kroy•

really long time

that's an understatement. haha, I think I had a box once that took like an hour to run that.

5
mysticalfruit•

I recently had to move a whole pile of home directories from one zfs box to another... I could have done them individually, but I said screw it. I'd run a direct 10gigE link between the boxes. I dropped a snapspot and did the zfs send -R pool/toplevel@migrate | mbuffer => mbuffer | zfs recv -F newpool/toplevel.

That in itself took a 175 hours...

Removing that snapshot took at least three hours, I honestly don't know because I backgrounded the process and went on to other things.

3
ffiresnake•

there should be no significant performance issue with 2k filesystems

see zol github issues 821, 845, 4462, 4773, 1484, 4727 - although most of them should be a thing of the past - note the hint on 821 about using automounter should still be a valid optimisation method that applies to any filesystem.

5
thulle•

821, 845, 4462, 4773, 1484, 4727

821, 845, 4462, 4773, 1484, 4727

6
radiowave•

It might put a few seconds on the boot time as they all get mounted. Otherwise should be fine.

4
bjd2385•

I've never thought about this. Interesting.

1
diamaunt•

There's a limit, but like all limits in zfs, they're so large as to be practically unlimited, you'll run out of disk space before zfs says "nope"

3
Girlydian•

Shouldn't make much of a difference. Go for it :)

2
rlaager•

Whether you can or not is different from whether you should. The question to ask yourself is: do you need separate datasets? Are these datasets going to have different properties, snapshot retention policies, etc.? If not, then leave them in one dataset.

2