Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
So this is basically two physical disks, / partition of 20G and the rest is LVM of 3.6T. Both are ext4.
I have an issue of /var/lib/mysql/ibdata1 getting too large and the space on the / partition runs out fully every day and this is blocking the working of the websites that I run.
I have a certain and specific situation and I am not sure what would be the best way of resolving that.
1) Is it possible to resolve the issue of the /var/lib/mysql/ibdata1 growing too large?
2) What is the best way of enlarging the / partition to something like 100 or 120G (what size would be good anyway?). I dont run any busy sites so I could shut them off completely for an hour or two if this would be needed. I know that some of this can be unsafe for the files on the / partition so I would not want to be risking anything.
I am not an advanced Linux user, but I work on everything by myself. This is another situation that I've come across so far and that I need to solve. I am not sure whether I should make the / partition LVM, is this a doable thing, can I do it on a live system, what am I risking and so on. There is articles on the Internet, but I dont have a definite answer to what would be the best for me yet.
#1 you could use a lesson on how to title a post to get answers to your question. This one is not clear or useful. There are pointers on this site. (For future reference and to speed up useful response. )
#2 you built a database server with the data on the root. It is almost always wise to provide partition separation between your OS and your data.
#3 if your system was set up in a protected (see #2) and versatile manner (LVM for everythig except swap and boot perhaps?) then migrating space would be much easier, but I am not sure about the risk in retro-fitting that in this case. It is more uncertain because yoou provide no volume size information other than for root. Without a bit more data about partition size and type, volume group makeup and size, etc. we are having to guess a lot out here. That does not mean we do not want to help, but you have not made it easy.
I have not run that kind of database server in about four years, so I will leave very pointed answers to those who know more about the current engine. I do have some system questions and suggestions.
Do you know why the database tables are growing so large as to crash your server?
The first solution may be to investigate the behavior, find the cause, and shut it down in the application and database itself.
Do you have the option of adding another drive dedicated to the data?
If so, adding a drive and migrating /var/lib/mysql there and then mounting it at /var/lib/mysql might: A: prevent it from filling up root and crashing your server, B: provide huge growth space for your database, C: separate the disk I/O and provide better performance (unless the new disk is a real dog!).
If that is not an option, can you provide the volume group, partition and file system size information, and any other useful information that the next person to respond might need to consider?
I do hope that this helps you, either with this issue or in prompting for more complete answers next time. Best of luck!
I already have an answer to this and I know what to do:
"If you have any free space as part of an LVM VG then you can create a new LV, format it, stop your mysql server, rename /var/lib/mysql and create a new one, mount your new LV on that then recursively copy all the content of /var/lib/oldmysql (e.g.) to it and start the server back up."
I was wondering out of curiosity and for educational purposes if adding more space to the sda2 would be a doable thing, and if so if it would be possible to do it on a system that is live.
I have two physical hard drives - sda and sdb. sda2 is / and this is 20G and the sda3 + sdb create a Logical Volume Group with the size of around 3.6T. I was thinking about freeing up some space from the sda3 and adding it to the sda2, but again, I am still not sure if this is a doable thing and something that can be done on a system that is live. As far as I was reading, it should be doable, but this can be a risky thing.
If somebody has an idea about it, it could be good to know how this would work for the edu purposes. Other than that, I already have the info that is good.
Thanks!
Last edited by AdultFoundry; 12-17-2016 at 01:39 PM.
I am still not sure if this is a doable thing and something that can be done on a system that is live. As far as I was reading, it should be doable, but this can be a risky thing.
I agree that this sort of partition manipulation is risky if you are doing the manipulation on the system you are running. I alway do this sort of thing from a rescue system. Rescue DVDs are slow (but safe to use) so I usually use a rescue system sited on a partition which plays no part in the disk space shuffle.
I still have a rescue DVD available in case I blow things up. As for backup, I back up both daily and weekly and keep backup 3 generations deep. When I do something like you are attempting I don't have to create a backup for the occasion as my regular daily backup suffices.
I have never had a problem expanding an LVM filesystem while it is live. The reason it exists, as far as I am concerned, is for making file system changes and expansions, while the system is live.
For sake of knowing what we are dealing with here, could you provide the output of these commands?
Best way of resolving this is probably just moving the whole /var/lib/mysql to where you have more disk space, and have it running from there. No need to deal with the LVM, backups and so on. If you do that, you need to add the new location to the /etc/php.ini file and this is not described in most of the articles on the Net.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.