I'm trying to mount zfs snapshot. It should to be so easy...but I can't do that. I'm using Ubuntu Server 11.10 Oneric, kernel 3.0.0-15-server.

Installed ZFS from ppa also I'm using zfs-auto-snapshot. With manually created snapshots the same situations.

How to mount zfs snapshot?

root@us1:/# zfs list -t snapshot
NAME                                                            USED  AVAIL  REFER  MOUNTPOINT
tank/www@zfs-auto-snap_hourly-2012-02-11-1917                   0      -   268K  -

root@us1:/# zfs mount tank/www@zfs-auto-snap_hourly-2012-02-11-1917 /mnt/snapshot/tank/www
too many arguments
        mount [-vO] [-o opts] <-a | filesystem>

For the property list, run: zfs set|get

For the delegated permission list, run: zfs allow|unallow

root@us1:/# zfs mount tank/www@zfs-auto-snap_hourly-2012-02-11-1917
cannot open 'tank/www@zfs-auto-snap_hourly-2012-02-11-1917': operation not applicable to datasets of this type

Running ZoL, just use the regular mount command like this:

mount -t zfs tank/www@zfs-auto-snap_hourly-2012-02-11-1917 /mnt/snapshot/tank/www

Dismount it like this:

umount /mnt/snapshot/tank/www

This is a bug that is being tracked at https://github.com/zfsonlinux/zfs/issues/173

  • Great tip to mount ZFS dataset without changing the mountpoint parameter – panticz.de Mar 12 '18 at 21:56

As of today, ZFS on Linux (ZoL) now also supports read-only access to snapshots via a invisible (not hidden, invisible) directory in the root of the dataset.

# ls -a /tank/test
./  ../  boot.tar  text.tar  text.tar.2
# cd /tank/test/.zfs/
# ls -a
./  ../  shares/  snapshot/

In the snapshot directory you'll find read-only copies of all your snapshots.

You can make .zfs visible via zfs set snapdir=visible tank/test.

Source: https://pthree.org/2012/12/19/zfs-administration-part-xii-snapshots-and-clones/

  • here's a reason why it's not visible by default – lucidbrot May 8 '20 at 13:19
  • once I unmounted one of the snapshot inside .zfs directory, all the snapshots no longer showing in snapshot/ .. to fix it I do zfs set snapdir=hidden and then zfs set snapdir=visible – YudhiWidyatama May 10 '20 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.