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.

Getting full?

Discussion in 'General Discussion' started by nickvdbrink, Aug 17, 2003.

  1. nickvdbrink

    nickvdbrink Active Member

    Joined:
    Mar 20, 2003
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    In my whm Disk hda5 (/var) DMA+ 81 % with a yellow thing
    i removed logs but its still yellow what can i remove on /var?

    thanks

    cPanel.net Support Ticket Number:
     
  2. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    Well the thing that would take up the most space in /var on a cPanel system is MySQL databases. You may want to check /var/lib/mysql to see if you have any huge databases. If you do and since they will continue to grow, you may either want to symlink some databases to another partition or get another hard drive and put MySQL DBs on it.

    You may also want to check your mail queue to see if that's taking up a chunk of space.
     
  3. Silverado

    Silverado Well-Known Member

    Joined:
    Mar 19, 2003
    Messages:
    154
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Backyard - Poolside
    you can safely remove anything in /var/log
    that has a number. Example is exim_mainlog (you wouldn't want to delete this), and exim_mainlog1 (you can delete this).
    You will find a lot of files in there if you do not check it weekly.
    I go through all my servers on a weekly basis and remove all the old uneeded log files in /var/log

    cPanel.net Support Ticket Number:
     
  4. nickvdbrink

    nickvdbrink Active Member

    Joined:
    Mar 20, 2003
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    $ du -h -s /var/*
    24k /var/aquota.user
    76k /var/arpwatch
    1.7M /var/cache
    330M /var/cpanel
    4.0k /var/db
    1.9M /var/ftp
    399M /var/lib
    4.0k /var/local
    8.0k /var/lock
    56k /var/log
    16k /var/lost+found
    0 /var/mail
    1.3M /var/named
    4.0k /var/nis
    4.0k /var/opt
    20k /var/portsentry
    4.0k /var/preserve
    4.0k /var/proftpd.pid
    28k /var/quota.user
    112k /var/run
    57M /var/spool
    4.0k /var/tmp
    4.0k /var/tux
    1.3M /var/webmin
    920k /var/www
    28k /var/yp

    how can i change the /var/lib/mysql dir??
    can i move the files and then symlink?
    can someone tell me how?
     
    #4 nickvdbrink, Aug 23, 2003
    Last edited: Aug 23, 2003
  5. micron

    micron Member

    Joined:
    Dec 1, 2002
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    your /var/cpanel is taking a lot of space. mines only taking 11M.

    cPanel.net Support Ticket Number:
     
  6. nickvdbrink

    nickvdbrink Active Member

    Joined:
    Mar 20, 2003
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    can someone tell me how i can resolve that?

    cPanel.net Support Ticket Number:
     
  7. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    The space taken by /var/cpanel is related to the number of accounts and subdomains.

    You probably will want to move your databases.

    Do you have somewhere else to put them?

    cPanel.net Support Ticket Number:
     
  8. nickvdbrink

    nickvdbrink Active Member

    Joined:
    Mar 20, 2003
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    yes in /home/mysql

    cPanel.net Support Ticket Number:
     
  9. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    If /home/mysql is currently empty, from shell, do this:

    mv /var/lib/mysql/* /home/mysql
    rmdir /var/lib/mysql
    ln -s /home/mysql /var/lib/

    The first line will move everything in the current mysql directory to the one in your home directory. The second line will remove the original mysql directory to allow a symlink to be created. The third line will create the symlink from the normal location to the new one. From there, the system will act as if nothing is different, except anything going to the mysql directory will be redirected to the new mysql directory location.

    It's probably a good idea to shut down the mysql server before doing this so nothing is being written during the move, but I'm not certain what the command is to stop and start it, so I'd wait till someone else can provide those commands first.

    That's what I did to move my log files to a 2nd drive.

    cPanel.net Support Ticket Number:
     
  10. nickvdbrink

    nickvdbrink Active Member

    Joined:
    Mar 20, 2003
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    Thanks i had some problems with the mysql.sock but i fixed it now itrs running thanks:)

    cPanel.net Support Ticket Number:
     
  11. nickvdbrink

    nickvdbrink Active Member

    Joined:
    Mar 20, 2003
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    Everything is working but in cpanel i get still a error.

    Mysql databases DBI connect('mysql:localhost','root',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at /usr/local/cpanel/Cpanel/Mysql.pm line 42 1 / unlimited
    Disk usage 12.61 Megabytes
    SQL Disk usage DBI connect('mysql:localhost','root',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at /usr/local/cpanel/Cpanel/Mysql.pm line 42 0.11 Megabytes

    how can i fix this?

    cPanel.net Support Ticket Number:
     
  12. ahwheelock

    ahwheelock Well-Known Member

    Joined:
    Nov 5, 2001
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    6
    our /var directories were getting full, and it ended up being a mail queue filling up because of SoBig. I bet you'll find your queue filled with 100K messages to a level 5 times normal.

    I mention this because is was the last place we looked. In retrospect, it should have been the first place.

    cPanel.net Support Ticket Number:
     
  13. nickvdbrink

    nickvdbrink Active Member

    Joined:
    Mar 20, 2003
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    we looked but it whas mysql

    cPanel.net Support Ticket Number:
     
  14. nickvdbrink

    nickvdbrink Active Member

    Joined:
    Mar 20, 2003
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    MySQL Account Maintenance


    Database Created
    Added the database gggggg. /usr/bin/mysqladmin: CREATE DATABASE failed; error: 'Can't create database 'ultimate_gggggg'. (errno: 13)'



    what can be the problem?

    cPanel.net Support Ticket Number:
     
  15. drmueyx

    drmueyx Active Member

    Joined:
    Oct 6, 2003
    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    6
    What does mysql.com say error 13 is?
    Just curious to in the post about sumlinkin the mysql files to the /home directory shouldn't it be:
    ln -s /home/mysql /var/lib/mysql/

    So that /var/lib/mysql is being refered to in the link and not just /var/lib ??

    Unless I'm missing somethign, which is entirely possible, that should be the correct way and also let mysqwl start working again.

    Is that right anyone? Does that work for you?

    cPanel.net Support Ticket Number:
     
  16. drmueyx

    drmueyx Active Member

    Joined:
    Oct 6, 2003
    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    6
    shouldn you siymlin k /varf/lib/musql instead of /var/lib?

    That wouls seem to clear up /var getting filled and get mysql working since it is trying to get to /var/lib/mysql instaed of just /var/lib.

    Let me know if this works for you or not and if I'm completely daffy or not.

    Thanks

    Dan

    cPanel.net Support Ticket Number:
     
  17. spaceman

    spaceman Well-Known Member

    Joined:
    Mar 25, 2002
    Messages:
    481
    Likes Received:
    0
    Trophy Points:
    16
    Has anyone written a script to do this so that a cron job can take of this clean-up task every week, month, or whatever? That would be very handy. I could write this in PHP, but don't have the perl skills.
     
  18. drmueyx

    drmueyx Active Member

    Joined:
    Oct 6, 2003
    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    6
    Forget PHP, it blows! :) try this in your crontab:
    There's probably a better way but it's simple and
    effective. It should remove files in /var/log that *end* with a digit. Is that what you want?
    You may need to install the File::Slurp module from WHM or change it to use Perl's readdir function.
    (The indents that make it pretty aren't seen in the forum, look at the source to see the beutiful style!)
    <pre>
    #!/usr/bin/perl -w

    use strict;
    use File::Slurp;

    for(read_dir('/var/log')) {
    chomp;
    if($_ =~ m/\d$/) {
    print "Removing $_\n";
    unlink "/var/log/$_" || print "Error : $! \n";
    }
    }
    </pre>
    HTH
    Dan
     
    #18 drmueyx, Nov 7, 2003
    Last edited: Nov 7, 2003
  19. drmueyx

    drmueyx Active Member

    Joined:
    Oct 6, 2003
    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    6
    Actually I just realized we don't want to kill directories by accident, so use this instead, it's safer:

    Also if anyone asks nice I may post a version that will email the results out when run instead of relying on crontab to email someone.

    Don't forget to look at the indents! It's much easier to read!

    #!/usr/bin/perl -w

    use strict;
    use File::Slurp;

    my $dir = '/var/log/';

    $dir .= '/' unless $dir =~ m/\/$/;
    for(read_dir($dir)) {
    chomp;
    if($_ =~ m/\d$/ && !-d "$dir$_") {
    print "Removing $dir$_\n";
    unlink "$dir$_" || print "Error : $! \n";
    }
    }

    chmod 700 cleanvar.pl (root owns it)
    I have this in my root crontab:
    0 1 * * * /home/dmuey/scripts/cleanvar.pl

    One slight problem I see is that eximmain.5.gz does not get deleted because it does not end with a digit and it would seem we want to kill it. So we could modify the regex to kill anythgin with adigit but then whatabout my cp4install.log ? Do I want to kill that? I don't think so. So we may need to figure out a better regex to determine what files need removed.

    Like change m/\d$/ to m/\d(\.gz)?$/i

    That will kill any files ending with a digit or ant files ending with digit dot g z (any case for the g and z)
    Also does this principle apply to files in directories in /var/log/ If so we I'll add a directory traversing function so we can clean to the deepest depths. We need more info in what is desireable thougth before we chnage anythign more.

    Dan Muey
     
    #19 drmueyx, Nov 7, 2003
    Last edited: Nov 7, 2003
  20. spaceman

    spaceman Well-Known Member

    Joined:
    Mar 25, 2002
    Messages:
    481
    Likes Received:
    0
    Trophy Points:
    16
    Thanks drmueyx, we'll give this a try v. shortly.
     
Loading...

Share This Page