>> Hi guys, we need to update our samba service from 2.2.8a >> to samba 3.0.x (so that we can upgrade our AD from Win2k >> to Win2k3). The problem I am having is with the quotas. > > I was never able to use the quota functions of samba. I use > Suse 8.2 with Samba 3.0.3 and XFS. Even the latest samba > version doesn't recognize quotas correctly. For me quota > code is broken since beginning in samba. > > To get them displayed I use a dirty hack. > In smb.conf I've added the following line: > dfree command = "/etc/script.sh %U" > > script.sh: > #!/bin/sh > used_space=`/usr/bin/quota -u $1 | tail -1 | awk '{print $2}'` > quota_space=`/usr/bin/quota -u $1 | tail -1 | awk '{print $4}'` > used_files=`/usr/bin/quota -u $1 | tail -1 | awk '{print $5}'` > quota_files=`/usr/bin/quota -u $1 | tail -1 | awk '{print $7}'` > if [ "$used_files" == "$quota_files" ]; > then used_space=$quota_space > fi > free_space=`expr $quota_space - $used_space` > echo "$quota_space $free_space"
I didn't know it was broken. What's broken? It works fine for me. I don't limit users. I limit projects (groups). Since a user may be in different projects there wouldn't be a single quota value or dfree number anyway. The important point is that each group can only use up what's allocated to it. I display quotas in a table on swat's status page like this: Quotas (See also: "What to do, if Quota is exceeded?") Group ? Used MBs SoftLimit HardLimit TOTAL 525637 665000 860000 CALCX 70728 0 0 PM1 1 105741 90000 110000 PM3 67125 70000 80000 ............ root 1985 0 0 users 2436 10000 15000 Everyone can see how much of the quota is used up in all of the groups he belongs to, root can see it all. The question mark column numbers the days remaining until grace expires. There's also a mail reminder to the project leader every day with a size-sorted list of all infringing files. By the way, I think your script is broken. Not only can you spare 3 iterations of quota and awk but the 5th and 7th columns ($5 and $7) of the quota output are "grace" and "(#files-)quota" if a value exceeds the limit instead of "files" and "limit", which is probably intended by you. A more careful coding would be: quota -u $1 | tail -1 | awk 'NF>7{$5=""} {print}' | \ read a used_space a quota_space used_files a quota_files a But I digress. What did you think was wrong with quotas in samba? -- To unsubscribe from this list go to the following URL and read the instructions: http://lists.samba.org/mailman/listinfo/samba