在 Ubuntu 16.04 上重新设置 sharenfs 属性之前,不会导出 ZFS 共享

Jai*_* R. 5 ubuntu zfs nfs zfsonlinux

我正在 Ubuntu Server 16.04LTS 上设置 ZFS 和 NFS,但有一个奇怪的问题让我发疯。我已经使用 ZFS 共享设置了 ZFS 和 NFS,如https://pthree.org/2012/12/31/zfs-administration-part-xv-iscsi-nfs-and-samba/ 中所述。正如您在下面的日志中看到的那样,尽管我已将 zfs-share 设置为zfs share -a在引导期间运行,但仍然没有导出共享。更奇怪的是, zfs share -a当我手动运行它时仍然没有。如果我重置sharenfs其中一个共享的属性然后重新运行,我只能让 zfs 共享工作zfs share -a。见下文

$ showmount -e
Export list for apu:
/mnt localhost
$ sudo zfs share -a
$ showmount -e
Export list for apu:
/mnt localhost
$ sudo zfs share pool1
cannot share 'pool1': filesystem already shared
$ sudo zfs get sharenfs pool1
NAME   PROPERTY  VALUE     SOURCE
pool1  sharenfs  on        local
$ sudo zfs set sharenfs=on pool1
$ showmount -e
Export list for apu:
/s/apu/a/homes *
/s/apu/a       *
/s/apu/a/sys   *
/mnt           localhost
$ sudo zfs share -a
$ showmount -e
Export list for apu:
/s/apu/b       *
/s/apu/a/homes *
/s/apu/a       *
/s/apu/a/sys   *
/s/apu/b/cwc   *
/mnt           localhost
Run Code Online (Sandbox Code Playgroud)

Ala*_*ect 3

我的 Ubuntu 16.04.05 LTS 也有类似的问题。

第一个问题:您使用的是systemd还是旧式的init系统?16.04默认使用systemd ,并且 ZFS 组件没有得到很好的调试。

下次重新启动并且您的共享不存在时,请尝试:

# systemctl restart zfs-share.service 
Run Code Online (Sandbox Code Playgroud)

然后查看是否有showmount的共享。顺便说一句,在我的系统上,我遇到了 RPC 注册服务出现的问题,因此您可能需要执行以下操作:

# systemctl start rpcbind.service
Run Code Online (Sandbox Code Playgroud)

如果rpcbind没有首先运行。

如果这可以缓解您的问题,您可以考虑将这些命令添加到系统 rc 文件中,但我只是在每次重新启动时手动执行此操作。