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