Submitted by sfatula on Thu, 12/09/2010 - 18:33
Is there a way to NOT store MySQL databases in /var? I want to store them on their own drive (and not with the rest of var), I'd prefer to mount it as /MySQL. But, am thinking this will mean the quotas and space used by user won't work.
Perhaps it is better to mount the drive at /var/lib/mysql instead?
Thoughts?
Status:
Closed (fixed)
Comments
Submitted by JamieCameron on Thu, 12/09/2010 - 19:43 Comment #1
You could certainly mount a drive at /var/lib/mysql , or mount it elsewhere and symlink /var/lib/mysql to the mount point.
However, this will prevent quotas from being used to enforce DB size limits, as quotas only apply to a single filesystem at a time.
Submitted by sfatula on Thu, 12/09/2010 - 19:45 Comment #2
Is there a way to patch up quotas to make it work? On a high performance servers, it's not wise to mix in logging with database.
Submitted by JamieCameron on Thu, 12/09/2010 - 19:48 Comment #4
There's no way to get quotas to work across filesystems other than changing the way the whole quota system works at the kernel level ..
Submitted by andreychek on Thu, 12/09/2010 - 19:48 Comment #5
Hmm... what about putting /var/log on a different partition rather than the databases? Then quotas wouldn't be an issue.
Submitted by sfatula on Thu, 12/09/2010 - 22:00 Comment #6
I suppose that's possible, was just one example. Was trying to keep everything in var out except mysql. There's a lot of other stuff there as well. But, the idea may be the same - I could symlink all diretories except lib/mysql I suppose. That's a lot of directories! esp counting the ones in /var/lib
I didn't mean change the os to make quotas work, I meant Virtualmin to use a different drive for the quota.
Submitted by sfatula on Thu, 12/09/2010 - 22:04 Comment #7
This comment is in your install doc:
"Other partition layouts may lead to incorrect configuration of filesystem quotas, but can be corrected after installation is completed if other partitioning schemes are preferred."
So.... I took that to mean there is something I can do to correct the quotas, perhaps a few manual commands for example.
Submitted by sfatula on Thu, 12/09/2010 - 22:35 Comment #8
Hmmm, and now I notice something else... Does the current virtualmin NOT set quotas on the /var filesystem? Mine (the reloaded one) does not have any quotas set there. Yet, virtualmin seems to report database space? ButI thought I recalled one day in the past it used to be set also on /var partition?
Submitted by JamieCameron on Thu, 12/09/2010 - 22:36 Comment #9
Virtualmin will be default use quotas on whatever filesystem contains the home base directory, which is by default /home. If you opt to put virtual server directories elsewhere, you can enable quotas on that filesystem instead.
One option would be to put MySQL DBs under /home/mysql , and symlink /var/lib/mysql to /home/mysql .
Submitted by sfatula on Thu, 12/09/2010 - 22:44 Comment #10
So confused!
Separate issues perhaps:
Your install doc says it supports partition scheme 2, which I am using on my restored machine. That is. a partition for /home, and /var. Since the install doc says this is ok, and quotas are set to enforced, why would /home have quotas set, but not /var by the installer??? Since /var does not have quotas set in fstab, how are database quotas (which are enabled) being enforced? I don't get it. Is Virtualmin perhaps manually adding them up? Is /var not supposed to also have quotas set?
Depending on the answer to that, if on another server, I decided to do what I said and move MySQL to it's own partition, say /MySQl, couldn't I simply enable quotas on the partition and all is well? Or, will it mess something up, perhaps new accounts>
Submitted by sfatula on Fri, 12/10/2010 - 00:15 Comment #11
So, If I am reading the code correctly....
mysql_size is used, not quotas, to compute the space used by MySQL databases for a given user. That is found in feature-mysql.pl. That subroutine get the MySQL directory from the mysql_data config which I am guessing comes from the webmin setting.
If that is all true, then, there should be no reason that I couldn't put MySQL database wherever I want, and, they WOULD be counted for the users disk space.
Or, did I read it all wrong?
Submitted by JamieCameron on Fri, 12/10/2010 - 00:48 Comment #12
The issue with using two separate filesystems is that Linux has no way to add together the usage from both and check it against a single limit. So the best Linux can do is have a separate limit on each filesystem .. and Virtualmin doesn't even have support for that.
For MySQL databases, if the DB files are on the same filesystem as /home they will have their group IDs set to match the owner, so that Linux quotas apply to databases and their size is counted towards the user's usage.
If they are on a different filesystem, Virtualmin will count the size of the DB files separately. It can then send you an email notification if a domain is at or over quota, but it cannot prevent a DB from growing the consume more disk space that the domain's quota.
Submitted by Locutus on Fri, 12/10/2010 - 04:49 Comment #14
Maybe an additional note (and example for a "real-life" configuration).
To make use of software RAID-1 (mdadm) for the "important data", while keeping the system itself on an "easier to manage" filesystem, I have / on a regular ext3 partition, and
/home
on an mdadm device.I then moved the databases from
/var/lib/mysql
to/home/mysql
and modified MySQL's config accordingly (instead of creating a symlink). Thus I have RAID protection for the databases, and also quotas active.Submitted by sfatula on Fri, 05/27/2011 - 18:46 Comment #15