just notes

steps to setup zfs samba share


References:

  • https://wiki.samba.org/index.php/File_System_Support1
  • https://wiki.samba.org/index.php/Setting_up_a_Share_Using_Windows_ACLs#Preparing_the_Host
  • https://jrs-s.net/2018/08/17/zfs-tuning-cheat-sheet/
  • https://arstechnica.com/information-technology/2020/05/zfs-101-understanding-zfs-storage-and-performance/

Initial setup

All my testing is based on ubuntu 20.10, samba4, zfs:

# apt install zfsutils-linux
# apt install samba

# uname -a
Linux hostname 5.8.0-1019-raspi #22-Ubuntu SMP PREEMPT aarch64 aarch64 aarch64 GNU/Linux

# samba --version
Version 4.12.5-Ubuntu

# zfs --version
zfs-0.8.4-1ubuntu11.2
zfs-kmod-0.8.4-1ubuntu11.1


Initial test

$ sudo su
# for n in {0..1}; do truncate -s 10G /tmp/$n.raw; done
# exit
$ sudo zpool create -o ashift=12 test mirror /tmp/*.raw
$ sudo zfs create test/testshare
$ sudo zfs set quota=1GB test/testshare
$ sudo zfs set recordsize=16K test/testshare
$ sudo zfs set compression=lz4 test/testshare
$ sudo zfs set xattr=sa test/testshare
$ sudo zfs set atime=off test/testshare
$ sudo zfs set acltype=posixacl test/testshare
NOTE: the last command is needed to pass the tests outlined in this samba wiki page.

Samba setup for basic sharing

Test for acl support

# smbd -b | grep HAVE_LIBACL

The output should be:

HAVE_LIBACL

If not, as the Samba wiki says,

If no output is displayed:

Samba was built using the --with-acl-support=no parameter.

The Samba configure script was unable to locate the required libraries for ACL support. For details, see Package Dependencies Required to Build Samba.

$ sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
$ sudo nano /etc/samba/smb.conf

Add the following section at the bottom of the [global] section.

...
vfs objects = acl_xattr
map acl inherit = yes

[printers]
   comment = All Printers
...

Setup permissions

sudo zpool create -o ashift=12 inatek1 /dev/sda1
sudo zfs create inatek1/rp4share
sudo zfs set recordsize=16K inatek1/rp4share
sudo zfs set compression=lz4 inatek1/rp4share
sudo zfs set xattr=sa inatek1/rp4share
sudo zfs set atime=off inatek1/rp4share
sudo zfs set acltype=posixacl inatek1/rp4share
smbd -b | grep HAVE_LIBACL
    # output should be "HAVE_LIBACL
sudo zfs set mountpoint=/zfs/rp4share/ inatek1/rp4share
sudo chown -R beau:GROUPNAME /zfs/rp4share/
sudo zfs set quota=10GB inatek1/rp4share
sudo vim /etc/samba/smb.conf
 #   Setup this config:
[SHARENAME]
    inherit acls = Yes
    browseable = yes
    writeable = yes
    create mask = 0775
    directory mask = 0775
    path = /zfs/rp4share/
    read only = no
    comment = test

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.