Register for the iXsystems Community to get an ad-free experience

How to access ZFS snapshots over SMB

Mara

Dabbler
Joined
Jan 14, 2017
Messages
48
Starting in 11.1-U5 we added some knobs to expose ZFS snapshots over SMB. You can enable by setting the following auxiliary parameters to your SMB shares:
Code:
zfsacl:expose_snapdir=True
veto files = /.windows/.mac/


Then restart samba. The ZFS dataset still has the "snapdir=hidden" property set so you'll have to type in the full UNC path to the snapshot directory. Macs can mount with the following string: smb://<server>/<share>/.zfs/snapshot
Windows can access by navigating to \\<server>\<share>\.zfs\snapshot

You can do the same with Linux mounts if needed.

Hope you all find this useful.

Thank you for this ! where I have to edit this parameter in freenas 11.2?
zfsacl:expose_snapdir=True
veto files = /.windows/.mac/

thanks!
 

Mara

Dabbler
Joined
Jan 14, 2017
Messages
48
Hi anodos,

thank you ! but I'm a noob... I'm discovering Freenas more deeply and when you talk about sharing, I guess you're referring to the Snapshots folder? The problem is that I do not know where my snaps are going :(

For exemple I have "Stockage/iocage" in my "Periodic Snapshot Tasks" with "Recursive" every 1 week for the frequency.
How do I know where my Snapshot folder is? Do I have to share it in SMB?
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
8,990
Hi anodos,

thank you ! but I'm a noob... I'm discovering Freenas more deeply and when you talk about sharing, I guess you're referring to the Snapshots folder? The problem is that I do not know where my snaps are going :(

For exemple I have "Stockage/iocage" in my "Periodic Snapshot Tasks" with "Recursive" every 1 week for the frequency.
How do I know where my Snapshot folder is? Do I have to share it in SMB?

There is a hidden directory at the root of every dataset ".zfs/snapshot/" so that if you have the following datasets
dozer/dataset1
dozer/dataset1/dataset2

You will have
/mnt/dozer/dataset1/.zfs/snapshot
/mnt/dozer/dataset1/dataset2/.zfs/snapshot


By default they will be hidden, but you can cd directly into them. If you need to make them visible, then you can set make them visible by running the command zfs set snapdir=visible dozer/dataset1
 

vlj

Dabbler
Joined
Oct 25, 2019
Messages
14
Servername: NAS
SMB Share Name: Files
Pool Name: TresTBZ
Snapshotname: TresTBZ@auto-20191105.0945-3d
Auxiliary parameters checked
Server restarted

trying with \\nas\Files\.zfs\TresTBZ@auto-20191105.0945-3d but getting spelling error.
What im doing wrong?
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
8,990
Servername: NAS
SMB Share Name: Files
Pool Name: TresTBZ
Snapshotname: TresTBZ@auto-20191105.0945-3d
Auxiliary parameters checked
Server restarted

trying with \\nas\Files\.zfs\TresTBZ@auto-20191105.0945-3d but getting spelling error.
What im doing wrong?
Try navigating to \\nas\Files\.zfs\snapshot\
 

vlj

Dabbler
Joined
Oct 25, 2019
Messages
14

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
8,990
Thanks for your reply.
Got same spelling error :/
Type "testparm -s" in the shell and look at the path of the share. Then 'cd' into that path locally via shell and then 'cd' into ".zfs/snapshot". Verify that the directory actually exists. The snapshot directory will only exist on ZFS datasets (not arbitrary paths).
 

vlj

Dabbler
Joined
Oct 25, 2019
Messages
14
In fact, there are no such directory in this pool tree.


But funny to notice .zfs exists on our old pool, which was replaced by this new one. Have snapshots scheduled to this new pool and can view it Storage/Snapshots menu
 

thekaratekid

Cadet
Joined
Aug 12, 2020
Messages
1
Spent a while trying to access ZFS Snapshots via SMB on Windows, as well as having Explorer read it via Previous Versions in File History, and wanted to share what worked for me and what I learned. Searching online turns up a lot of different suggestions, issues, and mixed outcomes but I got it fully working without any of the messy solutions that show up.

One thing that tripped me up for a while is that on Windows attempting to access \\<server>\<share>\.zfs returned an error as if the directory didn't exist, however \\<server>\<share>\.zfs\snapshot works fine. For a while I figured I had something improperly configured.

If the snapshot directory is accessible via SMB, Windows users can also browse the snapshots via Windows File History in Explorer. Right-click on a mounted drive or directory, and go to Properties -> Previous Versions and they should be there.
Note: Apparently only scheduled snapshots will show up here. Others have said that manual snapshots do not appear.

Two things that may have changed since this thread:
1. On FreeNAS 11.3, the custom parameters in the OP are no longer needed. Just check off "Enable Shadow Copies" on the FreeNAS SMB config page.

2. Others have said that if the SMB is configured to a directory rather than the root of a pool, that snapshot history will not be accessible via that SMB.
While my SMB is mapped directly to a pool, I do have "Use as home share" enabled which starts the mount point at the user's home directory rather than the root of the pool. This seems to contradict this theory but perhaps since the actual SMB config points to the pool directly it still is accessible in some way.

3. I've seen a bunch of other posts elsewhere that say you can only access snapshots via Explorer's File History when using CIFS on Windows. Perhaps that used to be the case but not anymore. I'm on Windows 10.
 

seanm

Guru
Joined
Jun 11, 2018
Messages
552
@anodos now that ixnas is the default (and replaces zfs_space and zfsacl as I understand it), what is the status of the "zfsacl:expose_snapdir=True" aux param? From its name, it appears tied to the zfsacl VFS object? Is it still needed to get access to .zfs folder over SMB? Thanks.
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
8,990
@anodos now that ixnas is the default (and replaces zfs_space and zfsacl as I understand it), what is the status of the "zfsacl:expose_snapdir=True" aux param? From its name, it appears tied to the zfsacl VFS object? Is it still needed to get access to .zfs folder over SMB? Thanks.
No. That parameter is no longer needed either with zfsacl or ixnas.
 

seanm

Guru
Joined
Jun 11, 2018
Messages
552
One last clarification: "no longer" as of? I can remove "zfsacl:expose_snapdir=True" even in 11.3-U5? Thanks.
 
Top