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. We mount user home directories NFS and then export them to Windows users via samba. In 2.2.8a I was able to get quotas working. However with samba 3.0.x, I cannot. I compiled --with-quotas. Now when a user uses a 3.0 share, they see the space available on the whole disk, and when they save large files that push them over their hard limit, they can lose data. Does anyone know if there is a solution for us? PS: Our samba server is a Debian Woody Linux box with quota package installed. The command quota -v username works as expected. Many thanks, Rohit
Hi> 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" Tilo
>> 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?
>> > 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. >> >> I didn't know it was broken. What's broken? It works fine >> for me. > > I don't know if quotas are broken in general but I was never > able to get them work. I tried both compile options, > --with-quotas and --with-sys-quotasOne's own rebuilds are OK. But do use SuSE's spec file because it includes most anything you could want in your samba package. Like acls and quotas for example. Even if you want something very special it's easier to configure with the spec file.>> I don't limit users. I limit projects (groups). > > I only use user quotas. > > Samba take care of quota restrictions. Users can't write more > data than allowed by quotas. But clients don't show used space > and free space correctly. It shows complete disk usage and > complete free space instead of space used by user and max. > space allowed by quotasSo that's the rub. Is that how an MS Server would behave? It would show the capacity available to you as individual quotee? If it does, then there should be a smooth way to reproduce such behaviour for those who expect it, even if I don't personally think it makes much sense. I mean, free disk space is disk space not yet wasted on live files and available quota space is, well, available quota space. I would expect another mechanism to show me that value, not disk free. I'm not sure that samba is meant to show available quota space as disk free. The option "dfree command" sounds rather like it is provided as a fix for other possible problems but it's perfectly legitimate to tweak it in your sense.>> What did you think was wrong with quotas in samba? > > Thats the reason I've written it seems broken for > me and not in general. I don't know why it's exactly > not working. > > I don't know why they don't work for me. > I use Suse 8.2 standard installtion with all updates. > filesystem is XFS. > Samba is 3.0.3, self compiled. > Quotas are working fine but not in samba.Hold on there. What do you mean by the last sentence? Is it the disk free value erroneously showing total disk capacity minus occupancy instead of what you would expect from an MS server, or is it that quotas are not enforced by samba so that you can allocate more than you should be able to?> I've atached quota relevant parts of config.log. > I would be glad if you find an error in my configuration.I might come back to that log, after we make clear what exactly the problem is. You probably mean to say that samba handling of quota is broken because it doesn't behave the way you expect it to regarding the display of free space. I can't say for sure without MUCH more burrowing through the code but I guess that it's not implemented that way. You found and implemented an exemplary fix for it. Thanks for sharing it with the rest of us.