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 getting full

Discussion in 'Workarounds and Optimization' started by ullalla, Jul 20, 2010.

  1. ullalla

    ullalla Well-Known Member

    Joined:
    Jan 20, 2006
    Messages:
    192
    Likes Received:
    0
    Trophy Points:
    16
    It will be great if everyone put the ideas to empty the /var partition on cpanel server as its getting full again and again. Though I have tried few of them but need to know if there is anything else we can do?

    What I do :

    1) take the backup of importatn logs file in /var/log and empty them.
    2) checked for databases at /var/lib/mysql and removed unnecessary(which are not in use)
    3) I emptied /var/lib/slocate/slocate.db (is it good idea to do so ?)
     
  2. cPanelJared

    cPanelJared Technical Analyst
    Staff Member

    Joined:
    Feb 25, 2010
    Messages:
    1,842
    Likes Received:
    18
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    /var/lib/slocate/slocate.db is used by the locate command. locate lets you search for files without making the operating system examine each and every file (which the find command does, and it can be very slow). Instead, it searches a database that is maintained by the updatedb command. Deleting slocate.db will break the locate command, but it will not affect anything else.

    If you want the locate command to work, you can regenerate the database using these commands:

    Code:
    # touch /var/lib/slocate/slocate.db
    # updatedb
    It may take some time for the updatedb command to finish, depending on the size of the filesystems, how many files are on them, and how deep subdirectories are nested.
     
  3. ullalla

    ullalla Well-Known Member

    Joined:
    Jan 20, 2006
    Messages:
    192
    Likes Received:
    0
    Trophy Points:
    16
    Thanks for having look into this.

    But is there any other files that we can empty in order to get some disk space free ?
     
  4. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    What size is the drive or partition for "/var"? I ask because you may need to consider using a larger drive and or larger partition size when considering future growth and accounting for the natural increase of data being stored.

    Use the following commands as an example to obtain the disk usage for directories within the path "/var":
    Code:
    # du -ax --max-depth 1 /var | sort -n | tail
    # du -ax --max-depth 1 /var/lib | sort -n | tail
    # du -ax --max-depth 1 /var/log | sort -n | tail
    To show the disk usage in a human-readable format then you may also try the following examples (that will report files with sizes in Megabytes or Gigabytes, excluding files with sizes in Kilobytes):
    Code:
    # du -ahx --max-depth 1 /var | sort -k2 | egrep "[0-9](M|G)"
    # du -ahx --max-depth 1 /var/lib | sort -k2 | egrep "[0-9](M|G)"
    # du -ahx --max-depth 1 /var/log | sort -k2 | egrep "[0-9](M|G)"
    Using the disk usage information obtained you may consider whether or not to remove certain files; extreme caution should be practiced to ensure that required files are retained and not inadvertently deleted.

    I would also consider ensuring that your logrotate configuration has compression enabled, as seen by the following command and desired output:
    Code:
    # egrep "compress$" /etc/logrotate.conf
    compress
    If the directive "compress" is commented, that is, with an extra character in front of the directive to disable it, then you will want to edit the logrotate configuration file (at a path of "/etc/logrotate.conf") to remove the extra character.
    Code:
    # uncomment this if you want your log files compressed
    #compress
    You may also edit the same configuration file ("/etc/logrotate.conf") to reduce the number of older logs that are archived:
    Code:
    # keep 4 weeks worth of backlogs
    rotate 4
     
  5. ullalla

    ullalla Well-Known Member

    Joined:
    Jan 20, 2006
    Messages:
    192
    Likes Received:
    0
    Trophy Points:
    16
    cPanelDon,

    Thanks for the valuable information.
     
  6. ullalla

    ullalla Well-Known Member

    Joined:
    Jan 20, 2006
    Messages:
    192
    Likes Received:
    0
    Trophy Points:
    16
    though wanted to know is there any other files that we can remove or empty ? without creating any issue on the server?
     
  7. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    I cannot recommend removing just any file purely to reduce disk usage.

    What I do recommend is to thoroughly inspect what is consuming the most disk usage and then carefully evaluate how the data should be handled by your Systems Administrations personnel.
     
  8. DWHS.net

    DWHS.net Well-Known Member
    PartnerNOC

    Joined:
    Jul 28, 2002
    Messages:
    1,569
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    LA, Costa RIca
    cPanel Access Level:
    Root Administrator
    I know this is a really old thread but /var/cpanel/bandwidth has almost 7 gigs in it. How can I make sure removed accounts bandwidth is not there and is there a way to rotate some of the data off?
     
  9. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,476
    Likes Received:
    202
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    This post by cPanelKenneth should prove helpful I think: /var/cpanel/bandwidth folder size :)
     
  10. DWHS.net

    DWHS.net Well-Known Member
    PartnerNOC

    Joined:
    Jul 28, 2002
    Messages:
    1,569
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    LA, Costa RIca
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page