LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-08-2008, 05:22 PM   #1
helpmhost
Member
 
Registered: Oct 2006
Posts: 43

Rep: Reputation: 15
Mysql - Need to move ibdata1 file


Hi,

Our /var partition is full and it is causing problem with our MySQL database. We've noticed that the ibdata1 file is taking up about 90% of the partition. We need a quick solution. It doesn't have to be the best because this server is being shut down permanently in 4 months.

What I was thinking of doing is moving the ibdata1 file to a larger partition. From what I've read, I think the following might work but would like to know for sure.

1. Stop the mysql server
2. Move the ibdata1 file to the other partition (/ibdata)
3. Edit my.cnf and add the following in the [mysqld] section:
innodb_data_home_dir=/ibdata
4. Restart the mysql server

Can anyone confirm if this will work in moving the file? Is there a chance that we lose some data in doing this?

Thanks.
 
Old 07-09-2008, 05:30 AM   #2
emi_ramo
Member
 
Registered: Apr 2007
Location: Barcelona, Spain
Distribution: Debian, KUbuntu
Posts: 213

Rep: Reputation: 36
Another possibility is to let untouch mysql conf and make a symbolic link of ibdata1.
 
Old 07-09-2008, 09:56 AM   #3
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 256Reputation: 256Reputation: 256
I'd also suggest cleaning up or archiving things you may not need any longer. If you are using InnoDB for your database, sometimes a simple mysqldump and restore will do the trick. InnoDB can become fragmented and doesn't reuse the space all that well. A dump and restore can sometimes free a lot of space. How big is the ibdata1 file currently?
 
Old 07-10-2008, 04:52 PM   #4
helpmhost
Member
 
Registered: Oct 2006
Posts: 43

Original Poster
Rep: Reputation: 15
Hi,

emi_ramo: Do you mean move the file to another partition, and create a symlink in the old spot pointing to the new one? I originally thought of doing this but was worried that MySQL might not work if it is pointing to a symlink.

trickykid: The file is currently about 1GB. And our database itself is actually very small. Less than 50MB. So would you suggest doing the following:
mysqldump --all-databases > alldb.sql
mysql < alldb.sql


Thanks to you both.
 
Old 07-10-2008, 09:30 PM   #5
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 256Reputation: 256Reputation: 256
Quote:
Originally Posted by helpmhost View Post
trickykid: The file is currently about 1GB. And our database itself is actually very small. Less than 50MB. So would you suggest doing the following:
mysqldump --all-databases > alldb.sql
mysql < alldb.sql


Thanks to you both.
I would imagine if you do a dump and the database is 50MB in size, you should be able to dump the database, drop the database, reimport and save you probably enough space to last the remaining 4 months or so.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
squirrel Could not move/copy file. File not attached mrlinux2000 Linux - Software 4 05-24-2010 03:41 AM
Trying to move datadir of mysql edudirectories Linux - Enterprise 1 02-14-2009 07:29 PM
LXer: Mysql puts off automatic move to GPL 3 LXer Syndicated Linux News 0 01-05-2007 05:33 PM
Trying to move datadir of mysql edudirectories Linux - Software 2 02-10-2006 06:25 AM
how to move a file to a different file system? iclinux Linux - Newbie 1 07-06-2005 10:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:33 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration