Closed geerlingguy closed 8 months ago
lol, found this post from way back in 2013 complaining of the same issue.
Solution might just be to manage the Samba config myself, too...
Can't do a manual rename, so looks like it's up to me to configure samba manually :)
jgeerling@nas01:/etc$ sudo zfs set sharesmb=on ssdpool/mercury%mercury
cannot open 'ssdpool/mercury%mercury': dataset does not exist
It looks like ZFS stores its samba configs inside:
root@nas01:/var/lib/samba/usershares# cat ssdpool_mercury
#VERSION 2
path=/ssdpool/mercury
comment=Comment: /ssdpool/mercury
usershare_acl=S-1-1-0:F
guest_ok=n
sharename=ssdpool_mercury
So I might just turn off smbshare
in the ZFS properties, have Ansible manage the filesystem, then manually create a file in /var/lib/samba/usershares
with the share itself...
That way I could just use creates: /var/lib/samba/usershares/[share name]
for the command.
Found via https://bbs.archlinux.org/viewtopic.php?pid=1628280#p1628280
Trying some automation but running into a weird issue with the formatting of the file, maybe:
root@nas01:/home/jgeerling# net usershare info --long
info_fn: file /var/lib/samba/usershares/jupiter is not a well formed usershare file.
info_fn: Error was Bad version number.
info_fn: file /var/lib/samba/usershares/mercury is not a well formed usershare file.
info_fn: Error was Bad version number.
root@nas01:/home/jgeerling# cat /var/lib/samba/usershares/mercury
# Ansible managed
#VERSION 2
path=/ssdpool/mercury
comment=Fast storage pool on SSDs.
usershare_acl=S-1-1-0:F
guest_ok=n
sharename=mercury
Ah... can't have a comment in that file... I moved that {{ ansible_managed }}
bit to the end of the Comment line, and now:
root@nas01:/home/jgeerling# net usershare info --long
[jupiter]
path=/hddpool/jupiter
comment=Archival storage pool on HDDs. (Ansible managed)
usershare_acl=Everyone:F,
guest_ok=n
[mercury]
path=/ssdpool/mercury
comment=Fast storage pool on SSDs. (Ansible managed)
usershare_acl=Everyone:F,
guest_ok=n
And now, it works!
jgeerling@nas01:~$ smbclient -L localhost
Password for [WORKGROUP\jgeerling]:
Sharename Type Comment
--------- ---- -------
print$ Disk Printer Drivers
IPC$ IPC IPC Service (nas01 server (Samba, Ubuntu))
mercury Disk Fast storage pool on SSDs. (Ansible managed)
jupiter Disk Archival storage pool on HDDs. (Ansible managed)
SMB1 disabled -- no workgroup available
Hooray!
Fixed via above commit. Yay!
I realize this is closed, but I since I was struggling to set my own share name the last few days. I just want to add what I came up with. I didn't want to edit/create the files usershares myself.
First the solution that OpenZFS accepts, created the unwanted sharename backpool_localmedia :
zfs set sharesmb=on backpool/localMedia
after that
net usershare add localMedia /backpool/localMedia "media share" martin:F guest_ok=n
This generates a second file in the usershares with the desired sharename "localMedia"
I can now mount with either sharename from another box. Maybe it helps you or others until zfs set share=name=fs1
works on OpenZFS
It looks like I've run into a bug:
And if I try setting it in Ansible's zfs module extra properties, like
sharesmb: 'name=jupiter'
, then I get:It looks like this is an issue in the Linux version of ZFS: https://github.com/openzfs/zfs/issues/1182
In Oracle's zfs SMB Share documentation, it suggests you can force a name if creating a share manually, e.g.:
What I might do is use Ansible's
zfs
module to create the dataset/filesystem, then manually runzfs share
to create the share with the specified name... need to figure out how to make that idempotent though. Maybe check the output ofsmbclient -L localhost
? That would require a password... Or dump the contents of whatever config file ZFS is setting up...