The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

/var is full, cant find specific problem

Discussion in 'General Discussion' started by flamesburn, May 10, 2008.

  1. flamesburn

    flamesburn Member

    Joined:
    Aug 5, 2002
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    Weve got a server where the /var is setup at 7gb, which is now %100 full.

    Weve deleted the common logs we always notice, but thats only gotten us down to %94.

    Anyone have any ideas what we should be cleaning or a good script that might help?
     
  2. flamesburn

    flamesburn Member

    Joined:
    Aug 5, 2002
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    seems 5.5gb of data is in /lib

    What is safe to delete from /lib and why is it taking up so much space?
     
  3. nyjimbo

    nyjimbo Well-Known Member

    Joined:
    Jan 25, 2003
    Messages:
    1,125
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    New York
    We have almost nothing in /var/lib on either our freebsd or centos boxes. Are you sure thats the folder?. If so then do some du's or check out the folders. Gotta be something really big or something went nuts and wrote logs or something. Check the mysql folders under lib if you have them there.
     
    #3 nyjimbo, May 10, 2008
    Last edited: May 10, 2008
  4. AndyReed

    AndyReed Well-Known Member
    PartnerNOC

    Joined:
    May 29, 2004
    Messages:
    2,222
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Minneapolis, MN
    You may be aware of this already, but just in case see: http://servertune.com/kbase/entry/320/
     
  5. Kailash1

    Kailash1 Well-Known Member

    Joined:
    Nov 27, 2006
    Messages:
    252
    Likes Received:
    2
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Twitter:
    It is not safe to delete /lib. WHM stores the MySQL databases in /var/lib/mysql (default location). Check the disk usage of all the folders in lib directory.

    Go to lib directory (cd /var/lib) and then give the below command:

    du -hs *

    Move the high disk usage directory to other partition which has enough space and then create a symlink in /var/lib to point that folder to new location.

    Kailash
     
    #5 Kailash1, May 11, 2008
    Last edited: May 11, 2008
  6. youdie

    youdie Member

    Joined:
    Feb 10, 2008
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    hello,

    i have the same problem , du sh * results

    12K alternatives
    8.0K bluetooth
    8.0K cs
    8.0K dav
    12K dbus
    8.0K dhclient
    8.0K dhcpv6
    8.0K dovecot
    8.0K games
    8.0K hal
    4.0K logrotate.status
    16K misc
    36M mlocate
    8.0K multipath
    7.8G mysql
    52K nfs
    8.0K ntp
    4.0K random-seed
    30M rpm
    48K sepolgen
    8.0K setroubleshoot
    8.0K spamassassin
    16K stateless
    8.0K up2date
    12K xkb


    MYSQL uses 7 gb of space, is it possible to move it to another directory without any data loss.

    Thanks
     
  7. vicos

    vicos Well-Known Member

    Joined:
    Apr 18, 2003
    Messages:
    62
    Likes Received:
    0
    Trophy Points:
    6
    Need better location for mysql data than /var

    I have the same problem... /var is always filling up because mysql data files are there and I have big databases. Plus /var is partitioned so small by default anyway...

    Would make alot more sense to have it on /home or even allow it to be admin-specified via WHM, i.e. I have a nice, fast second SCSI disk sitting there doing nothing but holding backups. Would be a great way to load balance the disks by putting the mysql data over there.

    Can someone from CPANEL give us a definitive answer on how we can safely move the MYSQL data to a larger partition. I'm not a mysql expert, and even if I was, not sure I would know if changing it would in any way disrupt the CPANEL way of doing things.
     
  8. vicos

    vicos Well-Known Member

    Joined:
    Apr 18, 2003
    Messages:
    62
    Likes Received:
    0
    Trophy Points:
    6
    I just moved my mysql data dir from /var/lib/mysql to a second disk where there is plenty of space.

    Here's the quick how to for those interested

    I am using RHE 5 with CPANEL (but this is all independent of CPANEL)

    0) ssh into root
    1) Stop mysql by "service mysql stop"
    2) cd to the location where you will copy the mysql data files
    In my case it was /backup --> cd /backup

    3) Copy the entire /var/lib/mysql to this location

    cp -r /var/lib/mysql ./

    4) chown to mysql:mysql

    chown -R mysql:mysql mysql

    5) edit /etc/my.cnf (I always make a copy before editing important files)

    look for the [mysqld] section.
    if you already have datadir=/var/lib/mysql change it to the new directory, otherwise add the parameter. In my case it was /backup/mysql

    You an also specify a diff dir for tmp file using tmpdir=/path/to/tmpdir

    6) save the file and restart mysql --? service mysql start

    You should not see any errors if all went well.

    Go into some user account and create a test database, then go to the new directory and see if the files appear. Should be a folder for each user acct with databases.

    I wouldn't delete the files in /var/lib/mysql until U R good-n-Sure this is working right.
     
  9. vicos

    vicos Well-Known Member

    Joined:
    Apr 18, 2003
    Messages:
    62
    Likes Received:
    0
    Trophy Points:
    6
    Just a note to confirm that CPANEL is smart enuf to pick the new location of the mysql DB files in its backup routines.

    Normally there is a tar file for _var_lib_mysql_ in the dirs directory of the respective backup. Just confirmed that there is a tar there today to match the new directory and not one for /var
     
  10. zigzam

    zigzam Well-Known Member

    Joined:
    May 9, 2005
    Messages:
    206
    Likes Received:
    0
    Trophy Points:
    16
    Have you had any issues since you moved the databases?
     
  11. vicos

    vicos Well-Known Member

    Joined:
    Apr 18, 2003
    Messages:
    62
    Likes Received:
    0
    Trophy Points:
    6
    All has been working well since the change. Althought it would be nice to have direct support in WHM for changing the location of the mysql DB dir.

    It's really not rocket science. I was mainly concerned that CPANEL/WHM was smart enuf to pick up the changes.

    Another option which I have also used is to have /var allocated more space when you buy/build a new server. I've had /var set to 25GB on new servers. softlayer.com is happy to accomodate custom partition sizes when you lease a new server.
     
  12. vicos

    vicos Well-Known Member

    Joined:
    Apr 18, 2003
    Messages:
    62
    Likes Received:
    0
    Trophy Points:
    6
    Actually, there is a better way to do the copy, use the -p switch to preserve the file owners and priv masks, i.e.

    cp -r -p /var/lib/mysql ./

    then you can skip the chmod step that follows above...
     
  13. xous

    xous Member

    Joined:
    Jun 12, 2007
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    I would actually recommend making the /var/lib/mysql directory a symlink to the new location.

    if you wanted to move it to home:

    i.e. ln -s /home/mysql /var/lib/mysql

    As everyone expects this data to be located in /var/lib/mysql.
     
  14. zigzam

    zigzam Well-Known Member

    Joined:
    May 9, 2005
    Messages:
    206
    Likes Received:
    0
    Trophy Points:
    16
    You can tell where your mysql directory is by checking the configuration file so its fine to place it anywhere you want.
     
  15. elliotcooper

    elliotcooper Well-Known Member
    PartnerNOC

    Joined:
    May 18, 2005
    Messages:
    56
    Likes Received:
    0
    Trophy Points:
    6
    Also, don't forget to stop chkservd before stopping mysql. chkservd is the self monitoring program on the server that checks that services like mysql are running. If it finds them stopped it will restart them. If it is running when you stop mysql then it may restart it mid way through the procedures listed above which could get very ugly.

    You can stop it byu running this command:

    /etc/init.d/chkservd stop

    and when you have completed the the work and restarted mysql:

    /etc/init.d/chkservd start
     
Loading...

Share This Page