LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 12-17-2016, 10:17 AM   #1
AdultFoundry
Member
 
Registered: Jun 2015
Posts: 282

Rep: Reputation: Disabled
Best way of resolving this situation


I have a disk / partitioning system that looks like this:

sda
-sda1
-sda2 (mountpoint /)
-sda3
--volgroup1-lvol0 (mountpoint /home)
-sda4 ([swap])
sdb
-volgroup1-lvol0 (mountpoint /home)

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.

Thanks.
 
Old 12-17-2016, 12:51 PM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,591

Rep: Reputation: 2689Reputation: 2689Reputation: 2689Reputation: 2689Reputation: 2689Reputation: 2689Reputation: 2689Reputation: 2689Reputation: 2689Reputation: 2689Reputation: 2689
#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!
 
Old 12-17-2016, 01:38 PM   #3
AdultFoundry
Member
 
Registered: Jun 2015
Posts: 282

Original Poster
Rep: Reputation: Disabled
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.
 
Old 12-17-2016, 08:29 PM   #4
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,336

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
Quote:
Originally Posted by AdultFoundry View Post
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.

-------------------
Steve Stites
 
Old 12-17-2016, 08:47 PM   #5
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
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?

Code:
fdisk -l
vgs
pvs
lvs
 
Old 12-18-2016, 02:22 AM   #6
AdultFoundry
Member
 
Registered: Jun 2015
Posts: 282

Original Poster
Rep: Reputation: Disabled
This is all ext4.

pvdisplay - prntscr.com/dkphus
vgdisplay - prntscr.com/dkpi1q
lvdisplay - prntscr.com/dkpibq
df -h - prntscr.com/dkpiju
/etc/fstab - prntscr.com/dkpiqu
 
Old 12-18-2016, 05:52 AM   #7
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
http://dba.stackexchange.com/questio...bdata-in-mysql
 
Old 12-19-2016, 06:00 AM   #8
AdultFoundry
Member
 
Registered: Jun 2015
Posts: 282

Original Poster
Rep: Reputation: Disabled
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
odd situation nofear3829 Linux - Networking 1 11-29-2009 03:31 AM
Which distro for this situation amlucent23 Linux - General 4 06-20-2006 11:43 AM
Serious situation, please help wardialer Mandriva 10 04-22-2005 01:43 AM
my situation thing0 Linux - Newbie 9 02-18-2005 12:22 PM
/etc/hosts resolving before DNS resolving ? markraem Linux - Networking 4 11-02-2003 04:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration