Submitted by applejack on Fri, 04/14/2017 - 07:52
The Disk usage overview amount is incorrect in that is does not show the total used by that virtual server i.e. home/vs as I am pretty sure it only shows the total for the user and group. This is a problem when files are owned by apache as they are not included, they are only included under the home directory tab. I need the overview including on the dashboard to show the total used for each virtual server.
Submitted by andreychek on Sat, 04/15/2017 - 09:15 Comment #1
You may want to try a rule like the one shared in the last post here:
My suggestion wouldn't be to flag those as spam, but instead just have it add to the total spam score.
Submitted by applejack on Sun, 04/16/2017 - 11:58 Comment #2
Not sure what that has got to do with my question ?
Submitted by andreychek on Sun, 04/16/2017 - 17:06 Comment #3
Absolutely nothing! This response was destined for someone else, but at the moment I'm not quite sure which support request that was supposed to be :-) Sorry about that!
Jamie will be able to comment better on the issue you're describing, as currently I think Virtualmin is designed to look at files owned by the Virtual Server owner, rather than files owned by the Apache user. But he'll have some thoughts for you on whether that's feasible.
Submitted by JamieCameron on Mon, 04/17/2017 - 21:57 Comment #4
Yeah, the Linux quota system only counts files owned by the domain owner to his quota, and files whose group is the domain's group to the overall server quota. I'd recommend running your PHP scripts via FCGID or FPM modes so that they don't create files as the
Submitted by applejack on Tue, 04/18/2017 - 08:08 Comment #5
But when you go to Admin Options > Home Directory tab it gives the correct usage so the disk usage stats on the system dashboard are misleading. Is there anything I can change so that they dashboard in effect show the same output as you would get from du -h ? Or might you consider changing it, as surely most server admins would want to see the total usage per virtual server ?
Submitted by andreychek on Tue, 04/18/2017 - 08:39 Comment #6
Is it an option to use a different PHP Execution Mode?
There's a few downsides to mod_php, what you're seeing now is one of them. We generally recommend against it.
You can change that in Server Configuration -> Website Options.
I suspect the mechanism used by the screen you're looking at to tally the home directory is more resource intensive than it is to use the quota command.
Also, the quota command retrieves usage information from the the entire server, rather than just the one set of directories.
Unfortunately, the behavior you're seeing isn't likely to change anytime soon.
If it's not an option to change PHP Execution Modes, perhaps you could create a script that runs from cron to change the group ownership of the files from www-data to the Virtual Server owner? That would allow both Apache and your Virtual Server owner to write to them, and they'd also be counted in the disk usage tally.
Submitted by applejack on Tue, 04/18/2017 - 09:54 Comment #7
Re: I suspect the mechanism used by the screen you're looking at to tally the home directory is more resource intensive than it is to use the quota command.
This is in each virtual servers Admin Options > Disk usage and doesn't appear to be any more additionally resource intensive in using it ?
Re: Is it an option to use a different PHP Execution Mode?
Most sites I have do run this way it is just in this particular case these sites run old legacy code and and so not sure if I wish to go through any potential hassle of changing them.
Anyway never mind and thanks for your help as always.
Submitted by JamieCameron on Tue, 04/18/2017 - 23:41 Comment #8
The page at Admin Options > Disk usage counts up all files under the domain's home, so will include even files owned by a different user. However, this calculation is expensive so it isn't used by Virtualmin normally for limiting disk usage.
Submitted by applejack on Wed, 04/19/2017 - 02:29 Comment #9
I wasn't after limiting it, just to display the stats on the dashboard, which if they do not accurately show the total is somewhat misleading, but of course we all have our different requirements and thanks for the explanation.
Submitted by JamieCameron on Wed, 04/19/2017 - 16:05 Comment #10
The short answer is, the dashboard gets the usage from the quota system which is based on file ownership. Counting up disk space under /home/$USER would take too long to display on the dashboard.