Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Samba] Custom, per share (or user) dfree command?

383 views
Skip to first unread message

Бак Микаел

unread,
Nov 28, 2012, 10:00:01 AM11/28/12
to
Hi list,

I am Mikael and I am new to this list.

In our data center I need to give some users low end "backup storage" to
Windows servers. For this I thought Samba shares could be a very easy
and nice solution.

I am able to limit the user's disk usage with file system quota, but
unfortunately the disk space and usage reported to the Windows machines
are the total amount of storage space and the total amount of space left
on the entire backup server. This is not that nice.

I would like to somehow tweak the way Samba reports disk usage and total
amount of disk space to its Windows clients. I could imagine a custom
script that I write to get the user's quota information and pass that
along to the clients.

I have noticed that there is a "dfree command" in the global section.
But that seems not to be able to work share specific. I must be able to
somehow resolve a username->share mapping and get quota from that
specific user.

I thought about using "homes" instead of plain shares, but I'm not sure
if that would help me in any way.

I also played with the idea to have each user a loopback mounted file
system of their own. Problem is that then they always use up all their
storage space even if they actually don't need it. That's far from optimal.

My backup server is an Ubuntu 12.04 LTS and the file system is ext3. The
reasons for that old file system are historical and not easily
replacable right now. But if changing file system is a requirement, I
will consider it.
The Samba version is the one packaged with Ubuntu (3.6.3-2ubuntu2.1).

I appreciate all help and hints I can get.
TIA,
Mikael Bak
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba

Bjoern Baumbach

unread,
Nov 28, 2012, 10:30:03 AM11/28/12
to
Hi Mikael,

On 11/28/2012 03:44 PM, Бак Микаел wrote:
> I am Mikael and I am new to this list.

Welcome to the Samba mailing list :-)

> I am able to limit the user's disk usage with file system quota, but
> unfortunately the disk space and usage reported to the Windows machines
> are the total amount of storage space and the total amount of space left
> on the entire backup server. This is not that nice.
>
> I would like to somehow tweak the way Samba reports disk usage and total
> amount of disk space to its Windows clients. I could imagine a custom
> script that I write to get the user's quota information and pass that
> along to the clients.
>
> I have noticed that there is a "dfree command" in the global section.
> But that seems not to be able to work share specific. I must be able to
> somehow resolve a username->share mapping and get quota from that
> specific user.

You can set the "dfree command" per share, but for use with the home
shares it would need some more configuration.

> I thought about using "homes" instead of plain shares, but I'm not sure
> if that would help me in any way.

Yes, this is the problem, you should use "homes".

I think the "get quota command" option is what you are looking for.
It's a global option that specifies a custom script which receives
amongst others information about the directory (e.g. /home) and a
specific user/group. In this script you can use system tools to
determine the needed values (e.g. free/used space). Please refer to the
smb.conf man page for more information about the get quota command.
Probably you'll find such a script for you system by searching for "get
quota command" and your quota system.

Best regards
Björn

--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kon...@sernet.de

Бак Микаел

unread,
Dec 3, 2012, 9:50:03 AM12/3/12
to
Hi Bjoern,

On 11/28/2012 04:25 PM, Bjoern Baumbach wrote:
> Hi Mikael,
>
> On 11/28/2012 03:44 PM, Бак Микаел wrote:
>> I am Mikael and I am new to this list.
>
> Welcome to the Samba mailing list :-)
>
>> I am able to limit the user's disk usage with file system quota, but
>> unfortunately the disk space and usage reported to the Windows machines
>> are the total amount of storage space and the total amount of space left
>> on the entire backup server. This is not that nice.
>>
>> I would like to somehow tweak the way Samba reports disk usage and total
>> amount of disk space to its Windows clients. I could imagine a custom
>> script that I write to get the user's quota information and pass that
>> along to the clients.
>>
>> I have noticed that there is a "dfree command" in the global section.
>> But that seems not to be able to work share specific. I must be able to
>> somehow resolve a username->share mapping and get quota from that
>> specific user.
>
> You can set the "dfree command" per share, but for use with the home
> shares it would need some more configuration.
>
>> I thought about using "homes" instead of plain shares, but I'm not sure
>> if that would help me in any way.
>
> Yes, this is the problem, you should use "homes".
>

Yep. You are right. As soon as I switched to "homes" and set group
quotas instead of user quotas everything worked as expected. No need to
hack "dfree command" or "get quota command". I'm happy!


> I think the "get quota command" option is what you are looking for.
> It's a global option that specifies a custom script which receives
> amongst others information about the directory (e.g. /home) and a
> specific user/group. In this script you can use system tools to
> determine the needed values (e.g. free/used space). Please refer to the
> smb.conf man page for more information about the get quota command.
> Probably you'll find such a script for you system by searching for "get
> quota command" and your quota system.
>

I found some examples in perl but as I said I did not need to implement
any special scripting after switching to "homes" and group quota on the
file system.

> Best regards
> Björn
>

Thank you very much for kicking me in the right direction!

Have a nice day,
Mikael

0 new messages