LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How can I use as much disk space as possible in MySql automatically? (https://www.linuxquestions.org/questions/linux-server-73/how-can-i-use-as-much-disk-space-as-possible-in-mysql-automatically-4175494526/)

unlike 02-11-2014 05:59 AM

How can I use as much disk space as possible in MySql automatically?
 
Hi.
I have a service that create a MySql database everyday. And the every database will be filled with about 40G data after created.
These databases are located in /data/mysql_data now. There is no doubt that /dev/sda4 will be full after decades of days. But as you can see below, I still has a lot spaces in /dev/sdb and /dev/sdc.
My question is: what's the best way to make MySql to use /dev/sdb (and then /dev/sdc) automatically after /dev/sda4 is full?

df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.9G 4.9G 4.5G 53% /
/dev/sda3 20G 812M 18G 5% /usr/local
/dev/sda4 885G 220G 621G 27% /data
tmpfs 3.9G 68K 3.9G 1% /dev/shm
/dev/sdb 3.6T 783G 2.8T 22% /data1
/dev/sdc 3.6T 924G 2.7T 26% /data2

Thx a lot!

unlike 02-11-2014 06:10 AM

A solution might be: making some soft links in /data/mysql_data when realizing there is not enough spaces in /data/, and located data files in another disk. But I think this might be not the best way. And the disadvantages are:
1. I cann't drop databases as before.
2. such shell script is kind of complicated, and I am not sure it will work in every context.

szboardstretcher 02-11-2014 11:41 AM

Simplest way would be to use a volume group that combines all of the drives together.

unlike 02-11-2014 07:44 PM

Quote:

Originally Posted by szboardstretcher (Post 5115680)
Simplest way would be to use a volume group that combines all of the drives together.

Thanks, szboardstretcher!
I havn't used or even known "volume group" yet. And I have searched and learned some of it.
http://www.centos.org/docs/5/html/Cl...ger/index.html

I wonder whether the original data(or the other service that running on this machine but having no idea that a volumn group has been created) would be affected after I created a volume group?

chrism01 02-12-2014 12:15 AM

You'd have to backup the DB and start over.
The LV/VG/PVs sit under the FS, so you also have mkfs.ext4 then put the DB etc back.

IOW: pv+pv+pv... = VG then carve into one (or more) LVs, then mkfs ontop of each LV, then install App SW.

HTH

PS I note that Section 5.1 of that link says '5.1. Creating an LVM Logical Volume on Three Disks', so follow that step by step AFTER taking 2(!) backups and checking them.

unlike 02-12-2014 06:16 AM

Quote:

Originally Posted by chrism01 (Post 5115986)
You'd have to backup the DB and start over.
The LV/VG/PVs sit under the FS, so you also have mkfs.ext4 then put the DB etc back.

IOW: pv+pv+pv... = VG then carve into one (or more) LVs, then mkfs ontop of each LV, then install App SW.

HTH

PS I note that Section 5.1 of that link says '5.1. Creating an LVM Logical Volume on Three Disks', so follow that step by step AFTER taking 2(!) backups and checking them.

I see. So the answer is that creating a volume group will destroy the data, which I don't want to. I cannot reformat the disk.
But thank you all the same!


All times are GMT -5. The time now is 10:09 PM.