LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-04-2010, 10:56 AM   #1
mindtattoos
LQ Newbie
 
Registered: Feb 2010
Posts: 7

Rep: Reputation: 0
How Do I Clean /var Storage on Dedicated Server?


The /var directory is 97% full on my dedicated server:

I would like to know if it is safe to clear it and how to clear it (assuming it will not disrupt/kill server services to do so).

I have Matrix control panel so i can view the storage etc but it does not have an way of clearing the /Var directory.

I have Putty Access to root but do not know which command to use.

I found a few threads but the information is not clear to me as there seems to be an assumption of basic knowledge I don't yet have.

My linux/ubuntu support that usually does this kind of thing for me is away and not contactable and my server is grinding to a halt and unable to store/send email.

I have only a very basic understanding of command line but really need to get this sorted ASAP.

Thanks

Last edited by mindtattoos; 02-04-2010 at 12:01 PM.
 
Old 02-04-2010, 12:04 PM   #2
Samael
Member
 
Registered: Oct 2008
Location: England
Distribution: Ubuntu and Fedora (64-bit)
Posts: 81

Rep: Reputation: 16
I have to do this regularly at work for some old FreeBSD machines we use. It'll probably be different process depending on how your machine is setup. We use Qmail and ClamAV, so when clearing space we generally clear unnecessary ClamAV logs and the logs for messages that have been sent by Qmail.

Check the amount of space you have by:

cd /var
du -h
 
Old 02-04-2010, 05:03 PM   #3
++nick++
Member
 
Registered: Dec 2008
Location: Bellevue,WA
Distribution: RHEL 5 , Fedora ,Sabayon,Solaris,Vmware,AWS
Posts: 107

Rep: Reputation: 18
Hi,

You can "rm -vf" old files in /var/log/ , that should help you free up some space
 
Old 02-04-2010, 06:29 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Start by getting a listing of the contents of /var

du -sk /var |sort -nk1

there are several dirs under /var; you need to treat them separately.
In eg /var/log you may see

messages
messages.1.gz
messages.2.gz

and similar.
A similar arrangement usually applies to other file in othe dirs under /var.
You can use

ls -lt to check/sort by date.

The 'current' file is the one without the number or gz extensions. Note that many orgs require you to keep backups of old logs, so do that first before removing them.
For safety's sake, use the rm cmd on one file at a time, no wildcards.

You should be controlling most logs via the logrotate facility; see /etc/logrotate.d dir.
Its possible you need to adjust the params in those files to rotate the files (ie close old file/gzip/start new file) more frequently.
It also sounds like your backup/archival system has either failed or needs tweaking in a similar way.
Normally the logs are self managing on a well run system.

Do NOT just blindly start deleting stuff, you will regret it.

Can you confirm your distro & version?
If necessary, post lists of the /var dirs so we can help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fedoora 11 (f11): /var full after yum update attempt. Can't clean. JEA Fedora 4 07-16-2009 03:58 AM
How to clean up disk space on /var partition RED HAT jmmo1981 Red Hat 11 02-24-2009 10:38 AM
how to clean /var directory UltraSoul Linux - Software 3 04-17-2008 03:41 AM
compile error: storage size of 'var' isn't known George2 Programming 7 04-03-2007 02:18 AM
How to clean up /var/log/messages ? JaBa Linux - General 10 10-30-2004 01:32 AM


All times are GMT -5. The time now is 05:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration