Can you view the list of snapshots in the terminal on Linux over SMB?

couchbed

Dabbler
Joined
Dec 14, 2022
Messages
19
I am accessing an SMB share on a Linux machine. I've set the snapshot directory on the dataset to visible. With these settings, I'm able to do this:
Code:
➜  /  cd /mnt/n/.zfs/snapshot
➜  snapshot  ls
ls: reading directory '.': Operation not supported
➜  snapshot  cd auto-monthly-2023-02-01_00-00
➜  auto-monthly-2023-02-01_00-00  ls
ASUS-backup  Files

So I can cd into /.zfs/snapshot , but I can't ls in it. I can also cd into a specific snapshot, and I can ls in that.
Is there a way to be able to list out the snapshots? Currently if I need to access a file from a snapshot, my easiest method is to open the WebUI, find the name of the snapshot, and then use that to be able to cd into it. It works but it's not too slick.

Is this different on an NFS share? I wouldn't be opposed to setting one up, but I access this share from Windows machines as well, so it's less to manage if I can just use the SMB share.

P.S. if anyone knows of a utility on Linux that works similar to the "previous versions" feature on Windows, I'd love to have that.
 
Joined
Oct 22, 2019
Messages
3,641
Which Linux distro (and version) is this?

On the latest updates for Arch-based distros with the 6.1 or 6.4 kernel, with KDE, Xfce, and COSMIC, I can list the contents inside .zfs/snapshot/ in the terminal and the graphical file browser.

I'm using TrueNAS Core, by the way.
 

couchbed

Dabbler
Joined
Dec 14, 2022
Messages
19
Which Linux distro (and version) is this?

On the latest updates for Arch-based distros with the 6.1 or 6.4 kernel, with KDE, Xfce, and COSMIC, I can list the contents inside .zfs/snapshot/ in the terminal and the graphical file browser.

I'm using TrueNAS Core, by the way.
Debian 12 (Bookworm)
TrueNAS Scale
Shell: zsh
Terminal: Alacritty
DE: none, i3 wm

I can try tomorrow with bash and see if that makes a difference.
 

couchbed

Dabbler
Joined
Dec 14, 2022
Messages
19
No luck in bash either.
I do need to update from TrueNAS-22.12.0 to TrueNAS-22.12.3.2 so that theoretically could solve the issue, but I doubt it. Might try to do that update tonight.
 
Joined
Oct 22, 2019
Messages
3,641
Curious. What if you list only the .zfs directory to view all permissions and hidden files?
Code:
ls -la /mnt/n/.zfs


Also, how are you mounting your SMB shares on your client? Which method? What options?
 
Last edited:

couchbed

Dabbler
Joined
Dec 14, 2022
Messages
19
Curious. What if you list only the .zfs directory to view all permissions and hidden files?
Code:
ls -la /mnt/n/.zfs


Also, how are you mounting your SMB shares on your client? Which method? What options?
That's the thing, ls doesn't work in .zfs or .zfs/snapshot. It says Operation not supported.

I'm mounting with this line in my fstab:
Code:
//192.168.1.2/steven /mnt/n cifs uid=1000,gid=1000,username=steven,password=<redacted>,comment=systemd.automount 0 0
 
Joined
Oct 22, 2019
Messages
3,641
What does mount reveal about its currently mounted options?
Code:
mount | grep /mnt/n
 

couchbed

Dabbler
Joined
Dec 14, 2022
Messages
19
What does mount reveal about its currently mounted options?
Code:
mount | grep /mnt/n
Code:
$ mount | grep /mnt/n
systemd-1 on /mnt/n type autofs (rw,relatime,fd=45,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=392)
//192.168.1.2/steven on /mnt/n type cifs (rw,relatime,vers=3.1.1,cache=strict,username=steven,uid=1000,noforceuid,gid=1000,noforcegid,addr=192.168.1.2,file_mode=0755,dir_mode=0755,soft,nounix,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1,closetimeo=1)
 
Joined
Oct 22, 2019
Messages
3,641
The only standout difference I see is you're not mounted with the "server inodes" option: serverino

That, and you're not using forceuid and forcegid.

See if it behaves correctly by adding those three mount options. Of course, you'll have to manually unmount / stop the systemd unit and prevent it from automouting before you make the changes. (Some culprits are file managers and other user applications that will prevent you from unmounting/stopping, if not immediately re-mounting it again. This includes "Recent Files".)

Code:
//192.168.1.2/steven /mnt/n cifs serverino,forceuid,forcegid,uid=1000,gid=1000,username=steven,password=<redacted>,comment=systemd.automount 0 0
 
Joined
Oct 22, 2019
Messages
3,641
UPDATE: Looks like this is due to the different ACL types used in Core vs SCALE.


Ironically, I'm in that thread as well, as a Core user trying to help out my cousins on SCALE. :tongue:

I'm unfamiliar with dataset management with the SCALE GUI. Is there a way to change the ACL type for a dataset? (POSIX.1e ACLs vs NFSv4 ACLs)
 
Last edited:

couchbed

Dabbler
Joined
Dec 14, 2022
Messages
19
UPDATE: Looks like this is due to the different ALC types used in Core vs SCALE.


Ironically, I'm in that thread as well, as a Core user trying to help out my cousins on SCALE. :tongue:

I'm unfamiliar with dataset management with the SCALE GUI. Is there a way to change the ACL type for a dataset? (POSIX.1e ACLs vs NFSv4 ACLs)
Ah, you're right. I do remember seeing that thread yesterday, but for some reason I thought it was something different, but it's exactly the same issue. My bad.

I won't lie, I'm not great with understanding how the heck ACLs work. I do remember that there are two different types you can set. This is what the GUI looks like:
truenas-acls.png

I believe these are the NFSv4 ACLs, and I think if I click the big scary red button "Strip ACL," it will turn it into the POSIX type. Not 100% sure though.

I guess according to that other thread, switching away from the NFSv4 ACL may solve the issue.

I'll be in for a hell of a ride if I start messing with the ACLs. Took me forever to get Nextcloud and Photoprism to be able to access this dataset, so I'm looking forward to having to figure that all out again. /s
 
Top