No access to snapshot folder (/.zfs)

AnosVoldigoad

Dabbler
Joined
Apr 4, 2021
Messages
17
Hi Guys,

i have TrueNAS Scale 22.02.1 and use SMB. In datasets i have activate Snapshot directory to visible. When I look into the dataset I see the folder .zfs but I can't look into it. As ACL Type i use NFSv4 and have Basic Modify access to dataset.

Can anyone help me?
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
The proper way to access is through File Explorer "previous version" in Windows or mounting the relevant @GMT-prefixed path for MacOS and Linux.
 

AnosVoldigoad

Dabbler
Joined
Apr 4, 2021
Messages
17
Hm
is there a tutorial for this (for Linux)?
and is it not possible to access the folder? Why is it possible to display it then.

According to the doku it should be possible or not?
 
Joined
Oct 22, 2019
Messages
3,641
Did you try specifying .zfs/snapshot

Yes. Manually type in the literal word snapshot
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
Did you try specifying .zfs/snapshot

Yes. Manually type in the literal word snapshot
This may not work on NFSv4 ACL type as currently implemented because .zfs and .zfs/snapshot is a virtual directory and so getxattr call will fail.
Code:
getxattr("/mnt/dozer/NFS4/.zfs", "system.nfs4_acl_xdr", NULL, 0) = -1 EOPNOTSUPP (Operation not supported)
 
Last edited:

AnosVoldigoad

Dabbler
Joined
Apr 4, 2021
Messages
17
yes exactly also with .zfs/snapshot i have no access. That means I would have to switch to POSIX?

The problem is that POSIX is very difficult to understand. It is very buggy for me.
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
is there a tutorial for this (for Linux)?
It's covered in manpage for mount.cifs.

Code:
       snapshot=time
              Mount  a  specific snapshot of the remote share. time must be a positive integer identifying the snapshot requested (in 100-nanosecond units that have elapsed since January 1, 1601, or
              alternatively it can be specified in GMT format e.g. @GMT-2019.03.27-20.52.19). Supported in the Linux kernel starting from v4.19.
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
yes exactly also with .zfs/snapshot i have no access. That means I would have to switch to POSIX?

The problem is that POSIX is very difficult to understand. It is very buggy for me.
POSIX ACLs aren't really buggy. They're just cumbersome and require understanding quite a few implementation details.

I just realized this would be an issue as of this post and so I will make an enhancement for 22.02.2 as I'm consolidating VFS modules for interacting with ACLs.

I am going to have to make snapdir visibility mutually exclusive from exposing "shadow copies" though since there are edge cases that are very problematic to deal with.
 
Joined
Oct 22, 2019
Messages
3,641
This may not work on NFSv4 ACL type as currently implemented because .zfs and .zfs/snapshot is a virtual directory and so getxattr call will fail.
Code:
getxattr("/mnt/dozer/NFS4/.zfs", "system.nfs4_acl_xdr", NULL, 0) = -1 EOPNOTSUPP (Operation not supported)
I'm on Core (12.0-U8.1), which might explain it?
 

AnosVoldigoad

Dabbler
Joined
Apr 4, 2021
Messages
17
that is fully cumbersome, especially because I first do not know what times there are all without looking.

Oh and with Widnwos I have the problem that I have to open the snapshot folders about previous version sometimes 2x - 3x until they are displayed to me.
 

AnosVoldigoad

Dabbler
Joined
Apr 4, 2021
Messages
17
POSIX ACLs aren't really buggy. They're just cumbersome and require understanding quite a few implementation details.

I just realized this would be an issue as of this post and so I will make an enhancement for 22.02.2 as I'm consolidating VFS modules for interacting with ACLs.

I am going to have to make snapdir visibility mutually exclusive from exposing "shadow copies" though since there are edge cases that are very problematic to deal with.
Does that mean I should just try again in the next version?
 

Jip-Hop

Contributor
Joined
Apr 13, 2021
Messages
118
I was also trying to access ZFS snapshots via SMB on TrueNAS-SCALE-22.02.1. Reading this thread I got the impression it should work when using ACL Type POSIX. So I made a test dataset with ACL Type POSIX, Snapshot directory Visible and made it an SMB share with Enable Shadow Copies turned on. Now I can list all the files in my test snapshots from MacOS Terminal with ls -laR .zfs/snapshot (cd into mounted SMB share first). Actually there's no need to set Snapshot directory to Visible. It also works without.
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
I was also trying to access ZFS snapshots via SMB on TrueNAS-SCALE-22.02.1. Reading this thread I got the impression it should work when using ACL Type POSIX. So I made a test dataset with ACL Type POSIX, Snapshot directory Visible and made it an SMB share with Enable Shadow Copies turned on. Now I can list all the files in my test snapshots from MacOS Terminal with ls -laR .zfs/snapshot (cd into mounted SMB share first). Actually there's no need to set Snapshot directory to Visible. It also works without.
Yes, I'm familiar with how this area of code works. In case of POSIX1E ACL code path samba synthesizes a generic NT security descriptor based POSIX mode. Similar logic isn't present in NFSv4 code, and so I'm adding for 22.02.2. I will also add logic to disable shadow copies automatically (and maybe generate alert) if ZFS snapdir is visible over SMB since the two options are somewhat incompatible.
 

rlpowell

Dabbler
Joined
Oct 6, 2022
Messages
25
Not sure how people will feel about me resurrecting this thread :D, but it's directly on-topic for me.

I have a simple dataset with a simple SMB share; I just recreated the SMB share from scratch, it is all defaults. The dataset should be all defaults at this point too. I'm running TrueNAS-SCALE-22.02.4

I want SMB users on Windows to be able to restore old files and directories. I can't get this to work at all.

If I set the snapshot directory to visible, the .zfs folder can be seen in Windows Explorer but can't be accessed ("operation not permitted", IIRC). Using .zfs\snapshot\ right in the path bar doesn't help.

If I set the snapshot directory to invisible, it is, well, invisible.

In either case, right-clicking on a file or directory and selecting "restore previous versions" shows "there are no previous versions available".

I specially made a test text file and changed it and made snapshots; nothing.

I have a mild preference for letting people browse the snapshots directory, but either method would be fine. Help?
 
Last edited:

rlpowell

Dabbler
Joined
Oct 6, 2022
Messages
25
After a complete reboot, I *do* appear to have files in "Restore Previous Versions"; restarting smbd was not sufficient.

Is there a way for MacOS clients to make use of that system?
 

SpaceRex

Cadet
Joined
May 13, 2022
Messages
6
Yes, I'm familiar with how this area of code works. In case of POSIX1E ACL code path samba synthesizes a generic NT security descriptor based POSIX mode. Similar logic isn't present in NFSv4 code, and so I'm adding for 22.02.2. I will also add logic to disable shadow copies automatically (and maybe generate alert) if ZFS snapdir is visible over SMB since the two options are somewhat incompatible.
I am on SCALE 22.12.0 and I was wondering if you ended up implementing this code for NFSv4 ACLs. Was hoping to be able to use NFSv4 and expose the .zfs/snapshots dirs under macOS / linux mounts

Thanks!
 
Top