Re: dovecot disk space settings

2019-10-22 Thread Joseph Tam via dovecot

On Tue, 22 Oct 2019, Plutocrat wrote:


I recently wrote a script to check disk space every week and email me
an alert if there was less than 5G.


Every week?  Unless you're using a telephone modem, an out of control mail
loop or being the victim of a joe-job can consume 5Gb of space in no time.
I recommend a more frequent interval if you're in the single digit Gb's.


MAILSPACE=$( df -h | grep "/dev/sdd" | awk '{ print $4 }' | sed 's/G//g' )
if [ "$MAILSPACE" -lt "5" ] ; then


If free space dips below 1Gb, (e.g. 900M), this will either fail
or do the opposite of what you want.  Maybe

MAILSPACE=$( df -k | awk '/\/dev\/sdd/{print int($4/(1024*1024)}' )

Joseph Tam 


Re: dovecot disk space settings

2019-10-22 Thread Benny Pedersen via dovecot

marcel bendler via dovecot skrev den 2019-10-22 10:52:

I don't want to restrict each mailbox size. It's just to prevent 
running

out space completely.


dovecot quotas policy server can limit out of space problems, the trick 
is to not allow more then storages can hold, if this test is done in 
postfix its only for postfix queue dir, not neseserly same partion that 
dovecot use to storage, but postfix can call dovecot policy service to 
check its not out of space, the dovecot policy service can still be 
optimised for this propose


Re: dovecot disk space settings

2019-10-22 Thread Plutocrat via dovecot
On 22/10/2019 6:38 PM, Marc Roos via dovecot wrote:
> Ok, what about placing a dummy file of 5GB or so on the partition, that 
> you can remove when necessary?

I recently wrote a script to check disk space every week and email me an alert 
if there was less than 5G. Would that be an approach for you? Enclosing below 
as an example. You'd need to adapt to your own environment. 

#!/bin/bash

MAILSPACE=$( df -h | grep "/dev/sdd" | awk '{ print $4 }' | sed 's/G//g' )

if [ "$MAILSPACE" -lt "5" ] ; then
MESSAGE="Alert, only $MAILSPACE Gb of space left on Mail Drive"
df -h > /tmp/diskalert.txt
mutt -s "$MESSAGE" m...@example.com < /tmp/diskalert.txt 
else
# Uncomment to debug 
MESSAGE="Safe for now: $MAILSPACE Gb of space left on Mail Drive"
#echo $MESSAGE
fi




Re: dovecot disk space settings

2019-10-22 Thread Giles Coochey via dovecot




-Original Message-
Subject: Re: dovecot disk space settings



I don't want to restrict each mailbox size. It's just to prevent

running out space completely.

Why? (If I may ask)



To provide mailboxes with unlimited space. And to make it easier to
administrate.
My question is about an emergency option if someone has forgotten to
migrate to new hardware. It's possible but a bit harder if the partition
is out of space and there is no free byte left.

Best,

Marcel



On 22/10/2019 11:38, Marc Roos via dovecot wrote:
  


Ok, what about placing a dummy file of 5GB or so on the partition, that
you can remove when necessary?

Or just monitor your disk space availability with a monitoring program 
(Nagios, CheckMK, whatever) and manage your disk space accordingly, you 
don't want to stop receiving email for your users, nor do you want to 
run out of disk space, and unless you have elastic storage in the cloud 
or something, you actually need to make decisions on managing available 
space (i.e. impose user limits, archive off old emails, buy new storage) 
and those decisions are not usually something that can be done 
automatically, unless you're using managed storage in the cloud.


--
Giles Coochey



RE: dovecot disk space settings

2019-10-22 Thread Marc Roos via dovecot
 

Ok, what about placing a dummy file of 5GB or so on the partition, that 
you can remove when necessary?



-Original Message-
Subject: Re: dovecot disk space settings


>> I don't want to restrict each mailbox size. It's just to prevent
> running out space completely.
> 
> Why? (If I may ask)
> 
>

To provide mailboxes with unlimited space. And to make it easier to 
administrate.
My question is about an emergency option if someone has forgotten to 
migrate to new hardware. It's possible but a bit harder if the partition 
is out of space and there is no free byte left.

Best,

Marcel




Re: dovecot disk space settings

2019-10-22 Thread Gerald Galster via dovecot
> 
> is there an option to leave some disk space free?
> Let's say, don't store new mails if the storage mount point has less
> than 1% free disk space.
> What's the way to go?
> 
> I don't want to restrict each mailbox size. It's just to prevent running
> out space completely.

emails are often accepted by an mta like postfix before handed over to dovecot.
You could configure a postfix policy service that checks your disk usage and
temporarily rejects new emails.

On the server you should check your filesystem: ext4 reserves 5% of storage
for root by default. If dovecot does not need root to deliver mails, you already
might have some space left.

Or you might use linux system quota. If all your mailusers are in the same group
you can set a group quota.

Another alternative would be to create a big dummy file that you can delete
if necessary. E.g. truncate -s 20g /var/mail/DELETEME   (man truncate)

Best regards
Gerald 

RE: dovecot disk space settings

2019-10-22 Thread Marc Roos via dovecot



> I don't want to restrict each mailbox size. It's just to prevent 
running out space completely.

Why? (If I may ask)