Page 1 of 1

Slow storage area

Posted: Sun Nov 03, 2019 3:06 pm
by wip
Hi everybody.
I'm using VestaCP since first releases, and I'm loving it every day more.
This is a request for already developed patch or, maybe, a feature request.
Nowadays, server are often equipped with fast SSD drives perfect for high performances in services like websites and related databases. But these drives have small capacity and high costs.
VestaCP, as all other hosting systems, are designed for web+db+mail domain hosting. But mail domains are the heavier part in terms of disk space.
My wish is to obtain a system that can rely web+db on SSD drives (fast service) and emails on legacy drives (slow service)
It is not difficult, in my opinion, to modify VestaCP source code and obtain a separate storage area for emails (with related modification to user's backup script).
But I'm not a programmer and maybe I risk to not consider something in VestaCP functions. Also, each new VestaCP release can create a disaster (especially when auto update, feature i love) in restoring traditional storage locations.
So, do someone successfully reached the goal to split storage area for emails?
Do developers can consider implementing this useful feature introducing little code modifications?
ThanX!!!
g

Re: Slow storage area

Posted: Wed Nov 06, 2019 2:18 am
by plutocrat
While your concept is good, I'm not sure what 'code modifications' you think the developers could make that would satisfy every individual use-case!

In fact, linux is more than capable of doing this itself, and it makes more sense to me if you adapt linux to fit your needs after installing Vesta CP. I have, for example, bought add-on storage for VM instances on Digital Ocean, Linode, AWS, and then mounted it where I need it. (eg /home/, or /backup/, or maybe /home/admin/mail in your case). This does exactly what you're asking: two levels of storage. Each platform gives different instructions on how to achieve this, but usually it involves editing /etc/fstab to mount the external storage where you need it.

There is also a way to tell dovecot to use two different tiers of storage, I believe, depending on age of email. You might want to look into that too.

Re: Slow storage area

Posted: Wed Nov 06, 2019 8:27 pm
by wip
Thank for your answer. I agree, Linux is incredible for customization.
The way you suggest I already made some modification to VestaCP overall system to let:
- Use Rainloop webmail instead of Roundcube
- Use php-fpm directly with NGINX (instead of NGINX + Apache) to serve webmail and phpmyadmin
- Backup data on different storage volume
- Include additional custom NGINX directives on each website (i.e. to limit max client connections or bandwidth)

For the mails to be stored in different storage volume, AFAIK, I'd have to symlink the mail path for the EACH user AFTER the user is created. EACH time logging into the shell as root. Not good.
Just to clarify, I have near 10 VestaCP installations. I'm not "admin" of the panels, but I'm the machine administrator. So I can't say to the VestaCP admins: "Please inform me each time you add a new customer (user) and please wait until I symlink the mail path"
Also, I don't know if the backup process (script) crawling inside each /home/{user}/ can follow the symlink of the mail directory. If not, not good.
To have it as normal behaviour, this time I need to modify VestaCP's scripts. But, as I wrote, all these scripts modifications will vanish on VestaCP updates. Not good.
So, if the modifications I made or I suggest are interesting for many VestaCP users, then I believe developers can consider to modify the code. And they can do it better than everyone else.
In my opinion, of course.
So, if somebody else has needing like mines, please vote +1 or help me to understand better how to modify the code.

Re: Slow storage area

Posted: Wed Nov 27, 2019 12:59 am
by wip
I found an interesting approach on Debian (may work for other distro too).
In

Code: Select all

/etc/dovecot/conf.d/10-mail.conf
we can find the dovecot configuration for the mail path of each user:

Code: Select all

mail_privileged_group = mail
mail_access_groups = mail
mail_location = maildir:%h/mail/%d/%n
pop3_uidl_format = %08Xu%08Xv
mailbox_list_index = yes
mailbox_idle_check_interval = 30 secs
maildir_copy_with_hardlinks = yes
I suppose

Code: Select all

%h
in mail_location directive is the home directory of the user, set by VestaCP in

Code: Select all

/etc/passwd
for each user.
So, substituting

Code: Select all

mail_location = maildir:%h/mail/%d/%n
with something like

Code: Select all

mail_location = maildir:/mail/%d/%n
and symlinking /mail/ path to slo storage device should do the trick.
But how do dovecot behave if

Code: Select all

/mail/%d%n
path does not exist? Can dovecot create it when the first email comes in for such a domain?
I'll soon have a try.
If somebody has dovecot's skills, please let me know.

Even if modifying dovecot configuration, the backup problem still ramains...
Developers, please consider little modification to the code and insert a "custom setting" to specify maildir location of the system.

Re: Slow storage area

Posted: Wed Nov 27, 2019 10:40 am
by mehargags
A better approach would be to "symlink" the directories on the bigger drive. I don't use mail on my webservers so can't really comment which folders, but I do such a setup for /home and /backup on many of my servers with multiple mixed storage. Symlink /backup to <biggerdrive>/backup and that's all take care off!!!

Re: Slow storage area

Posted: Wed Dec 11, 2019 7:53 pm
by wip
mehargags wrote:
Wed Nov 27, 2019 10:40 am
A better approach would be to "symlink" the directories on the bigger drive. I don't use mail on my webservers so can't really comment which folders, but I do such a setup for /home and /backup on many of my servers with multiple mixed storage. Symlink /backup to <biggerdrive>/backup and that's all take care off!!!
Not functional in many cases. As I wrote, the way you suggest forces the server administrator (with ssh root access) to make a symlink of the mail dir each time a new user is created.
Remember that the mail directories are located inside the /home/newuser path.
I don't want to put the whole /home in a separate slow-storage volume because I want high performance for website (image or file uploads)

Re: Slow storage area

Posted: Thu Dec 12, 2019 2:38 am
by plutocrat
wip wrote:
Wed Dec 11, 2019 7:53 pm
Not functional in many cases. As I wrote, the way you suggest forces the server administrator (with ssh root access) to make a symlink of the mail dir each time a new user is created.
How often do you create new users? Surely it's not too hard to spend ten seconds linking the directory when you do?

And if not, just write a script to scan the mail directories once a day and do the linking for you.

I think the Vesta team probably have more urgent priorities in their coding (ipv6 springs to mind). This seems to be a problem unique to you, which you could solve with a bit of scripting, as I suggested before. Here's a starting point
https://unix.stackexchange.com/question ... -directory