CIFS/SMB - AD - Quotas and reported share size

zetoniak

Dabbler
Joined
May 14, 2015
Messages
27
Hello,

I made a homes directory wich is working properly thru AD

When the end user see its homes share they see the total dataset quota size (i set it to 50G) wich at the moment its fine.

Then i set the next command for make a per user quota, setting it to 6G

zfs set userquota@"Domain\User"=6G Sata/COMON

Then the user continue seeing it as a 50G share, so i tryed to add the next line to the "Auxiliary parameters" under the CIFS network share "COMON"
Code:
get quota command = /usrquota.sh


usrquota.sh has this content
Code:
#!/bin/bash
zfs get userquota@%U Sata/COMON | awk '{print $3}'


But i still see 50G in my network share instead to see 6G, i've read around here and others places, but i cant find a solution for this.

Any suggestions?

Best regards, Juanjo.
 

zetoniak

Dabbler
Joined
May 14, 2015
Messages
27
I tryed that, i'm able to set the user quota wich is what i do in the first step

zfs set userquota@"Domain\User"=6G Sata/COMON

The problem is the reported disk size on the network location.

The reported disk size is wrong, but the quota applies properly, because if i reach 6GB writting it says me there is no more space.
 

zetoniak

Dabbler
Joined
May 14, 2015
Messages
27
Find an example for what i mean, i've applied the following command

Code:
zfs set userquota@"DOMAIN\juanjo"=1G Sata/COMUN


and it works properly but i want to display 1G instead of the dataset size, wich is 50G.

2xRwZUEPRFrg.jpg
 

lexxai

Dabbler
Joined
Nov 9, 2016
Messages
33

lexxai

Dabbler
Joined
Nov 9, 2016
Messages
33
some tuned scripts for get quota
use in samba config:

get quota command = /mnt/poolz2/home/scripts/quota_get.sh %U %D

Code:
#!/bin/sh
rtype=$4
if [ "${rtype}" == -1 ]; then
exit
fi
username=$1
if [ ! -z  "$username" ]; then
  domainname=$2
  requestpath=${PWD}
  DATASETNAME=`/bin/df -l ${requestpath} | /usr/bin/tail -n 1 | /usr/bin/awk '{ print $1 };'`
  info=`/sbin/zfs userspace -Hp ${DATASETNAME}  | /usr/bin/grep -i ${domainname}'\\\\'${username}`
  usedbytes=`echo ${info}| /usr/bin/awk '{ printf "%.f", $4/1024 };'`;
  quotabytes=`echo ${info}| /usr/bin/awk '{ if ( $5 == "none" ) { print "0"} else { printf "%.f", $5/1024 }  };'`;
  if [ "$quotabytes" != 0 ]; then
   echo 2 $usedbytes $quotabytes $quotabytes $usedbytes $quotabytes $quotabytes
  fi
fi
exit



for set default quota for all users by cron
Code:
#!/bin/sh

USERS_DATASET=poolz2/samba/users
DOMAINNAME=SOMEDOMAIN
DEFAULT_QUOTA=80G

zfs allow everyone userquota,userused ${USERS_DATASET}
mountpoint=`/bin/df  -l ${USERS_DATASET} | /usr/bin/tail -n 1 | /usr/bin/awk '{ print $6 };'`
for file in ${mountpoint}/*; do
    USERNAME=$(/usr/bin/basename "$file")
    LOGON=${DOMAINNAME}\\${USERNAME}
    QUOTA=`/sbin/zfs get -H "userquota@${LOGON}" ${USERS_DATASET} | /usr/bin/awk '{ print $3 };'`
    #echo ${LOGON} : ${QUOTA}
    if [ "$QUOTA" == "none" ];then
        /sbin/zfs set "userquota@${LOGON}=${DEFAULT_QUOTA}" ${USERS_DATASET}
        #echo Was set default quota ${DEFAULT_QUOTA} for ${LOGON}
    fi
done

#/sbin/zfs userspace ${USERS_DATASET}


source link
 

lexxai

Dabbler
Joined
Nov 9, 2016
Messages
33

lexxai

Dabbler
Joined
Nov 9, 2016
Messages
33
For 11.2-U2 I rewrote a portion of zfs_space so that it properly accounts for user quotas. I also introduced quota support in "ixnas", which allows setting / reading quotas via the Windows Explorer quota interface.
What minimum VFS Objects should be used for worked users quota ?
only zfs_space, only ixnas. And default_quota it not need to use since 11.2-U2 ?
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
What minimum VFS Objects should be used for worked users quota ?
only zfs_space, only ixnas. And default_quota it not need to use since 11.2-U2 ?
Only ixnas. I relaxed permissions to manage quotas slightly. DISK_OPERATOR_PRIVILEGE is required, but we now allow non-root users to set. This is a stepping stone to add a UI field "SMB Admin Group" that can be used to control this.
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
You can set a base quota for all authenticated users by adding the following auxiliary parameter for your share:
ixnas:base_user_quota = 10G
You can of course change this value. What happens is the first time a user connects to the share, samba will automatically set a user quota at 10GB for him.
 
Last edited:

lexxai

Dabbler
Joined
Nov 9, 2016
Messages
33
You can set a base quota for all authenticated users by adding the following auxiliary parameter for your share:
ixnas:base_user_quota = 10G
You can of course change this value. What happens is the first time a user connects to the share, samba will automatically set a user quota at 10GB for him.
Confirm. With VFS: ixnas only - all work.
samba-default-quota.PNG
 

seanm

Guru
Joined
Jun 11, 2018
Messages
570
Good. You can remove "zfsacl" from your vfs_objects list. ixnas does the same thing.

So are you recommending ixnas over zfsacl at this point? The docs call it 'experimental' but maybe the docs are just stale?
 
Top