2012-04-12

How to hide zfs snapshot directory

We are using intensively zfs znapshots. They are accessible by getting into ".zfs" directory. But sometimes you need to hide this directory. You can easily hide it by the following command:

zfs set snapdir=hidden

For example:

server:# ls -al .
total 4335
drwxr-xr-x  10 root     532           22 Jan  4  2008 .
drwxr-xr-x 101 root     root         100 Mar 28 09:46 ..
dr-xr-xr-x   3 root     root           3 Dec 13  2010 .zfs
...
zfs set snapdir=hidden (current/zfs/filesystem)
server:# ls -al .
total 4335
drwxr-xr-x  10 root     532           22 Jan  4  2008 .
drwxr-xr-x 101 root     root         100 Mar 28 09:46 ..
...


As you can see '.zfs' directory is hidden. Despite this fact you can always get into this directory (remember - it is hidden, not removed !) and use it :-)