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.

Move /var to home/var

Discussion in 'General Discussion' started by p.martin, Feb 28, 2012.

  1. p.martin

    p.martin Member

    Joined:
    Feb 23, 2011
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    I ordered a dedicated server a few month ago and I selected the default server partitioning my datacenter offered me (huge mistake). Unfortunately, now I only have 20G for /var and the rest on home/ (it's a 2TB hard drive).

    I already did everything I could to keep it down (otherwise I get an error on the cPanel) : changed the mysql and softaculous location and clearing the log and bandwidth logs (I don't need them) pretty often.

    But the directory keeps getting full and I would like to fix it once and for all, move /var to home/var.

    How can I do that ? Do I have any other option ?
    (I can't migrate or anything because I have hundreds of clients on it)

    Thank you !
     
  2. WebScHoLaR

    WebScHoLaR Well-Known Member

    Joined:
    Dec 14, 2005
    Messages:
    511
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Planet Earth
    Did you even check that what is filling up /var if you have moved the mysql that is mostly the largest folder in /var ? I suggest first analysing /var disk usage to find out whats consuming maximum space. Exim mail queue is also in that partition to keep an eye on it too.
     
  3. p.martin

    p.martin Member

    Joined:
    Feb 23, 2011
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Thanks.

    Yes MySQL and Softaculous were the largest directories and the mail queue is pretty empty.

    Would it be possible for me to move that directory ?
     
  4. Brian

    Brian Well-Known Member

    Joined:
    Dec 1, 2010
    Messages:
    117
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    It is not advised that you move all of /var to /home/var. cPanel & WHM is not tested with such significant parts of the OS symlinked to other partitions. I know for certain that moving and symlinking /usr away causes plenty of cPanel failures. I don't recall if this is the same for /var, but it is not something I would ever advise anyone do for any reason.

    Even if it works, it's the equivalent to applying a wad of duct tape to your server. It's not a clean or proper solution. The correct solution is going to be to backup all of your data and have your server provider re-provision your server with your desired partition layout. It may be a bit inconvenient for you to do that now, but it's going to be a clean and proper long-term solution that you won't have to worry about later.
     
  5. p.martin

    p.martin Member

    Joined:
    Feb 23, 2011
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Thanks.

    I have over 1Tb of data on it and it would cause great inconvenience along with the risk of data losses and long down times.

    In that case, could you tell me which directories I can clear safely with a cron task (knowing that I don't need ANY logs) ?
    For now I have :

    /var/log
    /var/cpanel/bwlimited
    /var/cpanel/bandwidth.cache
    /var/cpanel/bwusagecache
    /var/tmp

    Thanks.
     
  6. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello,

    You should not clear /var/tmp (which points to /tmp) due to the fact it has socket files for MySQL, mod_mono, etc. and it stores other temporary files for sessions that should automatically clear. EasyApache can fail if you are clearing /tmp while files write to it and caching will break if you are using EAccelerator or any other OPCode Caching mechanism and clear /tmp for those files.

    As for not needing log files, I cannot agree with clearing log files. Any server we have to investigate in our ticket system or on the forums, we will need the log files to troubleshoot. If you are clearing the logs for that specific service, the ability to track down the issue is severely impaired.

    Rather than clearing logs, set the logs to not archive or be saved when they rotate in /etc/logrotate.conf file for these lines:

    Code:
    # see "man logrotate" for details
    # rotate log files weekly
    weekly
    
    # keep 4 weeks worth of backlogs
    rotate 4
    
    # create new (empty) log files after rotating old ones
    create
    
    # use date as a suffix of the rotated file
    dateext
    
    # uncomment this if you want your log files compressed
    #compress
    Let's say you want to compress the archives and only save one copy on moving them daily, you'd change to this:

    Code:
    # see "man logrotate" for details
    # rotate log files weekly
    daily
    
    # keep 4 weeks worth of backlogs
    rotate 1
    
    # create new (empty) log files after rotating old ones
    create
    
    # use date as a suffix of the rotated file
    dateext
    
    # uncomment this if you want your log files compressed
    compress
    Since logrotate already handles the configuration of rotating logs, it makes more sense to use it over crons to clear out log files or remove them.

    Thanks!
     
Loading...

Share This Page