Disk usage overview amount is incorrect

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.

Status: 
Active

Comments

Hi Eric

Not sure what that has got to do with my question ?

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.

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 apache user.

Hi Jamie

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 ?

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.

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.

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.

Hi Jamie

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.

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.