LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


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

Rep: Reputation: 0
How Do I Clear /var/cache/apt/archives On My Dedicated Server?


Firstly I would like to apologize as I created a similar post in the general section but got no replies.. I hope it was just because it was in the wrong place...

I have a dedicated server and I am having email issues etc (seemingly) because the /var directory is 97% full

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 a '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 much about command line access.

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 support guru 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.

Is it possible and SAFE to delete files via FTP from the /var/cache/apt/archives??

This is driving me mad and I can't seem currently to get help anywhere..

Thanks
 
Old 02-04-2010, 11:21 AM   #2
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
I believe you can just delete the files in /var/cache/apt/archives, but the proper way to do it is to run apt-get clean or aptitude clean as root.
 
Old 02-04-2010, 11:39 AM   #3
mindtattoos
LQ Newbie
 
Registered: Feb 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by pljvaldez View Post
I believe you can just delete the files in /var/cache/apt/archives, but the proper way to do it is to run apt-get clean or aptitude clean as root.
Thanks for the response... I would rather do it the right way if possible as i can't afford to kill my server.

Can I log in with putty as root and then type:

# apt-get clean (or is it without the hash?)

and that wil do it?

thnks.
 
Old 02-04-2010, 11:53 AM   #4
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
If the machine is setup to ssh login as root, you can do that. Otherwise, you have to login as your username, then type su and enter the root password. Your prompt should change from something like [username@host:~]$ to something like [root@host]#. Then you just issue
Code:
[root@host:/home/username/]#aptitude clean
The "#" symbol should be part of the prompt already there, so you just enter "aptitude clean" without the quotes.

Last edited by pljvaldez; 02-04-2010 at 11:55 AM.
 
Old 02-04-2010, 04:40 PM   #5
mindtattoos
LQ Newbie
 
Registered: Feb 2010
Posts: 7

Original Poster
Rep: Reputation: 0
i can at least sleep now...

Quote:
Originally Posted by pljvaldez View Post
If the machine is setup to ssh login as root, you can do that. Otherwise, you have to login as your username, then type su and enter the root password. Your prompt should change from something like [username@host:~]$ to something like [root@host]#. Then you just issue
Code:
[root@host:/home/username/]#aptitude clean
The "#" symbol should be part of the prompt already there, so you just enter "aptitude clean" without the quotes.
Hi
You are a life saver... I did that and it saved me around 450mb so at least the server is working again now (it stopped when the Var hit 100%).

It is still reading at around 90% full... How do I clear the archived deb's off there? Some of them are 4 years old(?) am i rgith that they are no longer required?

thanks so much.
 
Old 02-04-2010, 06:23 PM   #6
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
That should have cleared all the debs that were downloaded by the system. Have you run find to see where the biggest files are located?
Code:
du -a /var | sort -n -r | head -n 10
You can replace /var with / to find the largest directories in /. Maybe it's no longer the debs?
 
Old 02-05-2010, 02:52 AM   #7
mindtattoos
LQ Newbie
 
Registered: Feb 2010
Posts: 7

Original Poster
Rep: Reputation: 0
It's Working!!!!!!!!

Quote:
Originally Posted by pljvaldez View Post
Maybe it's no longer the debs?
Hi
The sites and everything are running really smooth now and all is working but the /var is (according to my Matrix panel) at 90% still.

I just checked via FTP the /var/cache/apt/archives is now all but empty (just partial folder and lock file) so there must be a large selection of (4gb) elsewhere causing the lockup.


I will investigate. thanks for the help so far though... the info you have given me so far has free'd the server enough that it's fully functional again.


Chris
 
Old 02-05-2010, 06:43 AM   #8
mindtattoos
LQ Newbie
 
Registered: Feb 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Var/ mail & logs are both full of files.

hi
I had a look into the system as my /var seems to be filing up again... i am guessing that maybe the server is storing email (copies?) or something as the /var/mail folder has 4 files in it:
-----------------------------------------------
admin 4,996 <- file size
master2 51,198,029 <- file size
root 828 <- file size
www-data 3,393,677 <- file size
-----------------------------------------------

Could these be the issue? is it safe to delete the big one (master2)
If yes could I have a code for that

the /var/log also has lots of files in it... most of them seem to be (quite large) IZarc GZ Archives

any help?

thanks
 
Old 02-05-2010, 11:18 AM   #9
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
I wouldn't go deleting mail files without talking to the system admin and the corporate lawyers. There may be a requirement by your business to maintain backups of all the mail stuff. Did you poke around into that file at all and see what it is?

The log files typically rotate out on most systems (i.e. it keeps say the last 10 log files then starts drops the oldest one). You can check the settings in /etc/logrotate.d/ directory.
 
Old 02-06-2010, 03:02 AM   #10
mindtattoos
LQ Newbie
 
Registered: Feb 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Managed to source the issue...Its fixed now..

Hi
It turns out I don't need to mess with the mail (although I have that covered in my client terms and conditions - not to store mail on the serverlonger than 30 days.)

Eventually we discovered the reason the /var was filling up at a constant rate was due to MySQL transaction logs being created in var/log/MySQL. So we had to log into MySQL admin and 'flush-logs' via the command line with Putty.

Now it's working fine and all services have resummed. I will just make it part of my general 'housekeeping' to clear MySQL transaction logs down once a week (or when its getting loaded).

Thankyou for your time and knowledge though... It helped a lot.
 
Old 02-08-2010, 11:07 AM   #11
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
You might also poke around the mysql site for options you might be able to set. I would think there would be an option to clear the logs after a certain amount of time or when it reaches a size limit.
 
  


Reply



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
How to prevent apt from deleting packages in /var/cache/apt/archives ? abc.linux Debian 11 11-07-2009 11:46 AM
Can I remove files at /var/cache/apt/archives ? sarajevo Debian 2 05-08-2007 08:52 AM
cache folder like /var/cache/apt/packages on Debian Shaddy SUSE / openSUSE 0 08-13-2006 10:02 AM
/var/cache/apt/archives/lock error digsby0007 Linux - Software 3 06-23-2006 06:17 AM
Where are my .deb packages from /var/cache/apt/archives? bruno buys Debian 3 02-13-2005 07:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:45 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
Open Source Consulting | Domain Registration