I have a ZFS filesystem (ZFS version 0.8.5) on Linux (kernel 3.10.0) for which I'd like to restrict the total path length on nested directories. I'm not sure if there's a way to do that, though.
My backup software appears to have some limit just short of 4096 characters. To work around that, I'd like to have something in place where attempts to create a directory (or filename) that would result in a path length of more than 4000 characters will fail. (If this is a per-filesystem setting, the limit would have to be lower, since I'll have to take the length of the filesystem mountpoint's path into account.)
Is there a way to do that, either with the Linux kernel, ZFS module parameters, or ZFS filesystem properties? (Or some other avenue?)
Note that Linux's PATH_MAX
value is not a solution here. PATH_MAX
on my system is 4096, but I can easily create directories whose full paths exceed that limit. e.g.:
mkdir -p $(python -c 'print("/".join(["n" * 255] * 512))')
That will, without error, create a directory with 131071 characters from the current directory.