More Space

From: Tony C.
Sent on: Thursday, December 30, 2010 7:26 AM
Yesterday our /var got completely full.  One reason I believe is there was
a huge data table and a cronjob to make a backup of the huge data table
(so there were two). To clear it, someone removed the files in /var/lib/mysql
instead of deleting from table which I think would have been better.  Anyway
no matter how much we removed from /var it remained 100% full.  Even though
a du -s on the entrie system showed less than 1 gig, a df showed /var
capacity of 20G completely full so we figure the OS did not reclaim space
after deleting that way so we did a reboot.

Anyway someone noticed on this machine, /var is its own partition of 20G
(and mysql runs under /var/lib).  They wanted us to add more space to /var
which I had no idea how to do.  

But then I wondered, isn't it all controlled by /etc/my.cnf?  We have a
/home of like 418G of which 380G is still available.  Couldn't I do
something like this?


     mkdir -p   /home/data/lib/mysql­     # Make a new location
     mysqldump --all-databases > /home/saveme.sql
     service mysqld stop

Then edit /etc/my.cnf and change 
    datadir to /home/data/lib/mysql­
    socket to /home/data/lib/mysql­/mysql.sock
  err-log and pid-file are ok as they are I assume, and for some reason
  we commented basedir=

Do a  
   chown -R mysql:mysql /home/data
   service mysqld start       # start it again
   mysql < /home/saveme.sql   # restore database

and then it would be running on the new partition?  Or did I miss
something?

By the way:
mysql --version
mysql  Ver 14.12 Distrib[masked], for pc-linux-gnu (i686) using readline 5.0

we also sometimes use[masked]

---
/etc/my.cnf
   [mysqld]
   skip-name-resolve
   datadir=/var/lib/mys­ql
   socket=/var/lib/mysq­l/mysql.sock
   # Default to using old password format for compatibility with mysql 3.x
   # clients (those using the mysqlclient10 compatibility package).
   old_passwords=1
   #skip-innodb

   [mysql.server]
   user=mysql
   #basedir=/var/lib

   [mysqld_safe]
   err-log=/var/log/mys­qld.log
   pid-file=/var/run/my­sqld/mysqld.pid



Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy