Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Cannot mount CIFS shares shared via ZFS #1170

Closed
atoponce opened this Issue · 15 comments

4 participants

@atoponce

I've discovered a bug with mounting Samba shares on Debian testing with up-to-date packages and using the 0.6.0-rc13 packages compiled from source. First, I installed the necessary Samba packages, created my ZFS dataset, and made it available to Samba:

# aptitude install -R samba samba-client samba-tools cifs-utils
# zfs create -o casesensitivity=mixed -o sharesmb=on pool/srv
# zfs share pool/srv

Using the Samba client, I can verify that it is available (assuming 'eightyeight' is my workstation):

# smbclient -U guest -NL eightyeight 2> /dev/null | grep Disk
      print$          Disk      Printer Drivers
      sysvol          Disk      
      netlogon        Disk      
      pool_srv        Disk      Comment: /srv

Yet, trying to mount it fails:

# mount -t cifs -o guest '//eightyeight/srv' /mnt
Retrying with upper case share name
mount error(6): No such device or address
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

Trying to access the share via the interactive Samba client without mounting also fails:

# smbclient -U guest -N //eightyeight/srv
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.6]
tree connect failed: NT_STATUS_BAD_NETWORK_NAME

However, if I add the relevant config to /etc/samba/smb.conf and restart the Samba daemon, I can mount the share and browse it:

# awk 'NR>343' /etc/samba/smb.conf
[srv]
  read only = no
  browsable = yes
  guest ok = yes
  path = /srv
# mount -t cifs -o guest '//eightyeight/srv' /mnt
# ls /mnt
foo
# mount | grep srv
pool/srv on /srv type zfs (rw,relatime,xattr)
//eightyeight/srv on /mnt type cifs (rw,relatime,sec=ntlm,unc=\\eightyeight\srv,username=,uid=0,noforceuid,gid=0,noforcegid,addr=10.0.0.74,unix,posixpaths,serverino,acl,rsize=1048576,wsize=65536,actimeo=1)
# smbclient -U guest -N //eightyeight/srv
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.6]
smb: \> ls
  .                                   D        0  Wed Dec 26 15:11:40 2012
  ..                                  D        0  Thu Dec 27 13:40:23 2012
  foo                                          4  Wed Dec 26 15:11:40 2012

                40812 blocks of size 4194304. 40812 blocks available

Relevant operating system info:

# dpkg -l 'zfs*' 'spl*'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                                  Version                         Architecture                    Description
+++-=====================================================-===============================-===============================-================================================================================================================
ii  spl                                                   0.6.0-1                         amd64                           SPL Utils
ii  spl-modules                                           0.6.0-1                         amd64                           Solaris Porting Layer Modules
ii  spl-modules-devel                                     0.6.0-1                         amd64                           Solaris Porting Layer Headers and Symbols
ii  zfs                                                   0.6.0-1                         amd64                           ZFS Library and Utils
ii  zfs-devel                                             0.6.0-1                         amd64                           ZFS File System User Headers
ii  zfs-dracut                                            0.6.0-1                         amd64                           ZFS Dracut Module
ii  zfs-modules                                           0.6.0-1                         amd64                           ZFS File System
ii  zfs-modules-devel                                     0.6.0-1                         amd64                           ZFS File System Headers and Symbols
ii  zfs-test                                              0.6.0-1                         amd64                           ZFS File System Test Infrastructure
# uname -a
Linux eightyeight 3.2.0-4-amd64 #1 SMP Debian 3.2.35-2 x86_64 GNU/Linux
# lsmod | awk '/zfs/ || /spl/'
zfs                   809810  10 
zunicode              324505  1 zfs
zavl                   13115  1 zfs
zcommon                35894  1 zfs
znvpair                31373  2 zcommon,zfs
spl                   124517  5 znvpair,zcommon,zavl,zunicode,zfs
zlib_deflate           25638  1 spl

I can provide straces or other debugging output as needed.

@FransUrbo FransUrbo was assigned
@ismell

Is the path not //eightyeight/pool_srv ?

@atoponce

No. The path is //eightyeight/srv. The "pool/srv" mountpoint is "/srv" on the box, not "/pool/srv". This can be verified:

# zfs get mountpoint pool/srv
NAME      PROPERTY    VALUE       SOURCE
pool/srv  mountpoint  /srv        local
# mount | grep srv
pool/srv on /srv type zfs (rw,relatime,xattr)
@aikudinov
@atoponce

It won't share using standard authentication. Using guest is just a simple example. Also, as mentioned, I should not be sharing //eightyeight/pool/srv as the mountpoint is not '/pool/srv' but '/srv'. If that is what is expected, then that's another bug. Without ZFS, I can share //eightyeight/srv with no problem.

@FransUrbo
Collaborator
@atoponce

Having pool/srv mounted to /srv is not a bug. Using a Samba client to mount /pool/srv/ when it does not exist, is.

@aikudinov

Look, you run smbclient -U guest -NL eightyeight 2> /dev/null | grep Disk
and getting pool_srv Disk Comment: /srv

Then you are doing smbclient -U guest -N //eightyeight/srv
When you should run smbclient -U guest -N //eightyeight/pool_srv

You are confused, ZoL just picks dataset name, replaces slashes with underscores and uses it as share name, NOT the mountpoint!

@FransUrbo
Collaborator

Ok, so now I'M confused! Do we have a bug here or not? What IS the bug in such case?

@atoponce

Well, all I can tell you is that I still cannot mount a Samba share when using "zfs share" with "sharesmb=on", whether I use underscores, directory paths or datasets. Doesn't matter if I try "//eightyeight/pool_srv", "//eightyeight/pool/srv" or "//eightyeight/srv", it won't mount. The Samba clients can see that the share exists, but can't do anything with it. Further, I can mount the //eightyeight/srv directory path fine using native Samba config, getting ZFS out of the way.

So, if there exists some documentation on how to do this correctly, I would be much appreciated, but everything I've thrown at it shows me that I cannot mount a Samba share using ZFS natively. Has anyone even tried this? Or, are we arguing for the sake of argument?

@atoponce

Okay. So, tearing everything down, and starting from scratch, I am getting a "permission denied" error, as guest, my user, and root. So, I'm guessing I also need to make some modifications in the smb.conf. Again, docs would be helpful, seeing as though the Solaris ones from Oracle only go so far.

@FransUrbo
Collaborator

It's all in the man page - 'man zfs'. And the user you're trying to auth as must have access to the FS, naturally. Can you auth as 'my user' normally (i.e., against another share, not shared via zfs)?

@aikudinov

There is no bug, Aaron is just confused with how samba share names work, he seems to expect is to be same as mountpoint.
Nevertheless being able to change share name like on solaris would be nice feature. :)

edit: Check how usershares work in samba, because this is what zfs does. All their options are most likely stored in /var/lib/samba/usershares

@atoponce

I guess I'm confused, because the Samba tools share a directory. ZFS isn't doing that. :)

@atoponce

I'll close the ticket.

@atoponce atoponce closed this
@FransUrbo
Collaborator

Aikudinov, just for the record. Did you get it to work? It works for me, but there might be two other bugs lurking here:

  1. Documentation (see #1181).

  2. Changing share name (see #1182).

@FransUrbo FransUrbo referenced this issue from a commit in FransUrbo/zfs
@FransUrbo FransUrbo * Update manpage with more information about the ACL, guest access
  and that samba needs to be able to authenticate user(s).
* Add information that 'net' can be used to modify the share after
  ZFS sharing and that it will be undone with a 'zfs unshare'.
Closes: #1181

* Do basic sanity checks in smb_available() to verify that the 'net'
  command and the usershare directory exists.
Closes: #1124

* Give an example on how to mount a SMB filesystem shared via ZFS.
Improves: #1170
ab77da5
@FransUrbo FransUrbo referenced this issue from a commit in FransUrbo/zfs
@FransUrbo FransUrbo * Update manpage with more information about the ACL, guest access
  and that samba needs to be able to authenticate user(s).
* Add information that 'net' can be used to modify the share after
  ZFS sharing and that it will be undone with a 'zfs unshare'.
Closes: #1181

* Do basic sanity checks in smb_available() to verify that the 'net'
  command and the usershare directory exists.
Closes: #1124

* Give an example on how to mount a SMB filesystem shared via ZFS.
Improves: #1170
7ce092c
@behlendorf behlendorf referenced this issue from a commit
@FransUrbo FransUrbo Man page updates for SMB
* Update manpage with more information about the ACL, guest access
  and that samba needs to be able to authenticate user(s).
* Add information that 'net' can be used to modify the share after
  ZFS sharing and that it will be undone with a 'zfs unshare'.
* Give an example on how to mount a SMB filesystem shared via ZFS.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1181
Issue #1170
4a5b121
@FransUrbo FransUrbo referenced this issue from a commit in FransUrbo/zfs
@FransUrbo FransUrbo This is iSCSI sharing for ZoL (shareiscsi).
+ Merge from iscsi+smbfs+snapshot+zvol
  Commits:
    c519b70606fc2cfba3423aeed1f7d6dfbc55b27e
    Add some ignores (among them pkg files).

    9cc55935e3f1eed3cd0f67bfcc46aa5908e90927
    Indicate full 'path' (latest git commit date
    and all patches) in the Release tag.
+ Script to run through some tests to test share/unsharing...
+ Improve upon the module load string to include the Release
  from META.
+ New automake'd Makefile.in's.
+ Merge latest from iscsi+smbfs+mine
* Put the extra share script (/sbin/zfs_share_iscsi) as a define.
* Optional /etc/iscsi_target_id which contain the TID - this instead
  of autogenerating one (which changes every month!).
* Document iSCSI for ZFS for Linux.
* Makefile.in is recreated by autogen.sh so remove it...
* Remove a failed patch merge.
* Re-add some debug from ZoL:master.
* Mark the Release with the last GIT commit date.
+ In zfs_unmount(), support VOLUMEs. This function is called
  when (for example) doing a 'zfs destroy' on a shared volume
  as well as mounted filesystems so make sure we unshare instead
  of unmount any active volume.
* Simplify domainname retreival.
  + Tripple check before continuing with reversing it.
* Sanity checks for EXTRA_SHARE_SCRIPT, IETM_CMD_PATH and PROC_IET_VOLUME.
* Update manpage with more information about the ACL, guest access
  and that samba needs to be able to authenticate user(s).
* Add information that 'net' can be used to modify the share after
  ZFS sharing and that it will be undone with a 'zfs unshare'.
  Closes: #1181
* Do basic sanity checks in smb_available() to verify that the 'net'
  command and the usershare directory exists.
  Closes: #1124
* Give an example on how to mount a SMB filesystem shared via ZFS.
  Improves: #1170
* Remove superfluous ZFS_PROP_SHAREISCSI.
* Remove some extra heavy debugging I forgot to remove from
  my development of iSCSI/SMBFS!
3c29b4f
@FransUrbo FransUrbo referenced this issue from a commit in FransUrbo/zfs
@FransUrbo FransUrbo * Update manpage with more information about the ACL, guest access
  and that samba needs to be able to authenticate user(s).
* Add information that 'net' can be used to modify the share after
  ZFS sharing and that it will be undone with a 'zfs unshare'.
Closes: #1181

* Do basic sanity checks in smb_available() to verify that the 'net'
  command and the usershare directory exists.
Closes: #1124

* Give an example on how to mount a SMB filesystem shared via ZFS.
Improves: #1170
99e173e
@FransUrbo FransUrbo referenced this issue from a commit in FransUrbo/zfs
@FransUrbo FransUrbo Merge some SMBFS fixes from smbfs_fixes.
  * Update manpage with more information about the ACL, guest access
    and that samba needs to be able to authenticate user(s).
  * Add information that 'net' can be used to modify the share after
    ZFS sharing and that it will be undone with a 'zfs unshare'.
    Closes: #1181
  * Do basic sanity checks in smb_available() to verify that the 'net'
    command and the usershare directory exists.
    Closes: #1124
  * Give an example on how to mount a SMB filesystem shared via ZFS.
    Improves: #1170
e2f9356
@FransUrbo FransUrbo referenced this issue from a commit in FransUrbo/zfs
@FransUrbo FransUrbo Merge some SMBFS fixes from smbfs_fixes.
  * Update manpage with more information about the ACL, guest access
    and that samba needs to be able to authenticate user(s).
  * Add information that 'net' can be used to modify the share after
    ZFS sharing and that it will be undone with a 'zfs unshare'.
    Closes: #1181
  * Do basic sanity checks in smb_available() to verify that the 'net'
    command and the usershare directory exists.
    Closes: #1124
  * Give an example on how to mount a SMB filesystem shared via ZFS.
    Improves: #1170
cd32c13
@unya unya referenced this issue from a commit in unya/zfs
@FransUrbo FransUrbo Man page updates for SMB
* Update manpage with more information about the ACL, guest access
  and that samba needs to be able to authenticate user(s).
* Add information that 'net' can be used to modify the share after
  ZFS sharing and that it will be undone with a 'zfs unshare'.
* Give an example on how to mount a SMB filesystem shared via ZFS.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1181
Issue #1170
2f01f8d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.