Accessing previous versions via SMB

Fredda

Guru
Joined
Jul 9, 2019
Messages
608
As far as I understand it, accessing previous version of files via SMB only works if the smb share is a dataset on which snapshots are enabled.
I have a user volume /mnt/pool/user, share this volume as "homes", select the daily snapshot in the dropdown when configuring the share, everything is fine, users can access old versions of their file.

But I have a different dataset for projects /mnt/pool/projects, where subfolders are shared with access permissions on user level,
so there is a share for /mnt/pool/projects/project1 another /mnt/pool/project2 and so on.

I managed to make previous versions accessible by hacking the Auxiliary Parameters
Code:
  shadow:snapdirseverywhere = yes
  shadow:snapdir = /mnt/pool/projects/.zfs/snapshot
  shadow:basedir = /mnt/pool/projects/project1
  shadow:sort = desc
  shadow:localtime = yes
  shadow:format = auto-%Y%m%d.%H%M-2w
  vfs objects = shadow_copy2 zfs_space zfsacl streams_xattr

What I don't like here is that I have to overwrite the vfs objects. There are several vfs objects which can be additionally configured via dropdown but shadow_copy2 is not one of them. (At least in FN 11.2u7) Does anybody have an idea how to solve this in a better way?

Also, has anybody an idea how to catch all snapshots? shadow:format does not seem to handle any wildcards, I've seen shadow:snapprefix, but with the FreeNAS naming scheme for snapshots one would need a shadow:snappostfix attribute ...
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,545
As far as I understand it, accessing previous version of files via SMB only works if the smb share is a dataset on which snapshots are enabled.
I have a user volume /mnt/pool/user, share this volume as "homes", select the daily snapshot in the dropdown when configuring the share, everything is fine, users can access old versions of their file.

But I have a different dataset for projects /mnt/pool/projects, where subfolders are shared with access permissions on user level,
so there is a share for /mnt/pool/projects/project1 another /mnt/pool/project2 and so on.

I managed to make previous versions accessible by hacking the Auxiliary Parameters
Code:
  shadow:snapdirseverywhere = yes
  shadow:snapdir = /mnt/pool/projects/.zfs/snapshot
  shadow:basedir = /mnt/pool/projects/project1
  shadow:sort = desc
  shadow:localtime = yes
  shadow:format = auto-%Y%m%d.%H%M-2w
  vfs objects = shadow_copy2 zfs_space zfsacl streams_xattr

What I don't like here is that I have to overwrite the vfs objects. There are several vfs objects which can be additionally configured via dropdown but shadow_copy2 is not one of them. (At least in FN 11.2u7) Does anybody have an idea how to solve this in a better way?

Also, has anybody an idea how to catch all snapshots? shadow:format does not seem to handle any wildcards, I've seen shadow:snapprefix, but with the FreeNAS naming scheme for snapshots one would need a shadow:snappostfix attribute ...

In 11.3 you will be able to just check the "shadow copies" box and have it work (though there were some bugfixes in RC2 so you might need to wait for release).
 

Fredda

Guru
Joined
Jul 9, 2019
Messages
608
Thank for the information, great to hear that. Do you know by chance if it will also possible to recover from all different snapshot schedules?
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,545
Thank for the information, great to hear that. Do you know by chance if it will also possible to recover from all different snapshot schedules?
The module uses libzfs to find the snapshot create time to generate the shadow copy label. This means that _all_ snapshots will be presented (manual and from snapshot tasks). Since Windows GUI / RPC is limited in number of snapshots it can present, we prune down the number of snapshots by only showing ones that have >0 bytes used. This also has a side-benefit of making it so that you only see relevant snapshots. As stated 11.3-RC2 has a few bugs in it and so I would wait until release to rely on this feature.
 

Fredda

Guru
Joined
Jul 9, 2019
Messages
608
OK. Thanks. Fine for me. On a production server I usually wait for u1 or u2 anyway.
 
Top