Page 1 of 1

zfs set quota not reflected in windows share

Posted: 28 May 2015 15:44
by chris.shelton
Hi all,

I have managed to set quotas for all of my users by using the command:

zfs set userquota@username=1G pool1/data

and this quota does work because it won't let me transfer anything larger than 1GB onto the share. However, the quota does not seem to have affected the free space information on the share.

It says 14.2GB free of 14.3GB, I thought it would say something along the lines of 0.9GB free of 1.0GB.
How do I get the quota to reflect the free space on the network location once mapped?

Thanks

Re: zfs set quota not reflected in windows share

Posted: 28 May 2015 17:31
by b0ssman
no the default tells you how much free space the filesystem has,

if you want you will have to write your own script to report the size
and call it in samba via "dfree command =" option

Re: zfs set quota not reflected in windows share

Posted: 28 May 2015 19:46
by chris.shelton
b0ssman wrote:no the default tells you how much free space the filesystem has,

if you want you will have to write your own script to report the size
and call it in samba via "dfree command =" option
Hmm okay thanks for the info. I'm fairly new to this so do you have an example what such a script would look like? Or do you know of any resources that could help me?

Thanks

Re: zfs set quota not reflected in windows share

Posted: 28 May 2015 19:46
by b0ssman

Re: zfs set quota not reflected in windows share

Posted: 28 May 2015 19:51
by chris.shelton
Great thanks a lot. This looks to do what I am after, I will try it when back in the office tomorrow and post back the result.

Thanks again

Re: zfs set quota not reflected in windows share

Posted: 29 May 2015 10:22
by chris.shelton
Are you able to provide me with a brief explanation as to what the following is actually getting?

df $1 | tail -1 | awk '{print $2" "$4}'

Thanks, Chris.

Re: zfs set quota not reflected in windows share

Posted: 29 May 2015 10:23
by b0ssman

Re: zfs set quota not reflected in windows share

Posted: 29 May 2015 11:06
by chris.shelton
Okay at the moment I have something like this:

#!/bin/bash
zfs get userquota@%U pool1/data | awk '{print $3}'

I realise this won't give me exactly what I want and I am unsure whether the %U will work here to show each individual how much they have left.
Is what I'm trying to get actually possible?

Re: zfs set quota not reflected in windows share

Posted: 29 May 2015 11:39
by chris.shelton
zfs userspace pool1/data gives me a list of exactly what I need to be displaying - USED and QUOTA. But I don't know how to display the correct figures for each user...

Re: zfs set quota not reflected in windows share

Posted: 29 May 2015 16:57
by b0ssman
well this is where you have to start scripting.

the command is passed an argument which contains the path that is queried.
from this path you have to somehow arrive at the username which you then have to grep this list with.
and finally convert the values to the values that samba needs.
if a share with no quota is queries then the default free size has to be returned.