For example, in ZFS under FreeBSD and ZoL, there is a magic .zfs
dir inside of each zpool mountpoint and you can use zfs set snapdir=visible
to make that .zfs
dir visible.
What makes me curious is: if that setting is set to "hidden", how is the .zfs
dir actually hidden from the output of an ls -a
or shell path-auto-completion, while still being accessible otherwise (you can still cd
to it or call stat
on it)?
I can't really wrap my mind around this fact, because I somehow think if something is there and accessible it's supposed to be listed in ls -a
-- even if it's just magic/virtual in nature.
Can anybody explain how this works? Is there a POSIX conforming way to have a directory that is hidden from ls -a
while still being accessible? How do you do it?
.zfs
directory fromls
(and other user-space utilities that usereaddir()
) is to see what happens with the.zfs
directory visible. Run something likefind . -name somefilename
with a visible.zfs
directory, thefind
utility will descend into the.zfs
directory and search through every single snapshot for that file name, as well as the actual "active" filesystem.