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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
11-10-2009, 02:24 AM
|
#1
|
Senior Member
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,013
Rep:
|
disk space up to 60%
My disk space has grown from 30% to 60% in the last 3 months.
I can only assume this is from log files in the form of maillogs and squid logs.
Any ideas on how to free up the space? I'm pretty sure I have logroate running.
I just ran this on the mail log files:
cat /dev/null > /var/log/maillog
cat /dev/null > /var/log/maillog.1
cat /dev/null > /var/log/maillog.2
cat /dev/null > /var/log/maillog.3
cat /dev/null > /var/log/maillog.4
|
|
|
11-10-2009, 02:48 AM
|
#2
|
Senior Member
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339
|
if this isn't a server type:
Code:
sudo rm -rf /var
sudo rm -rf /tmp
sudo mkdir /var
sudo mkdir /tmp
reboot system immediately because it will be unstable until you do.
|
|
|
11-10-2009, 02:52 AM
|
#3
|
Senior Member
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,013
Original Poster
Rep:
|
Quote:
Originally Posted by smeezekitty
if this isn't a server type:
Code:
sudo rm -rf /var
sudo rm -rf /tmp
sudo mkdir /var
sudo mkdir /tmp
reboot system immediately because it will be unstable until you do.
|
it's a server
I have backe dup all /var and /etc files daily so have a record.
I cannot reboot due to people using the server.
|
|
|
11-10-2009, 02:56 AM
|
#4
|
Senior Member
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339
|
do not do those commands on a server! it will mess it up bad!
wait for another response.
|
|
|
11-10-2009, 03:27 AM
|
#5
|
Senior Member
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039
Rep:
|
Check for any individual large files.
The following searches for files over 50M in /var
Code:
find /var -size +50M
Additionally, search for core dumps
If you find anything that your not sure about, post here.
[EDIT]
Avoid running find on the /proc directory.
Code:
find / -path /proc -prune -o -name core -print
Last edited by Disillusionist; 11-10-2009 at 03:44 AM.
|
|
|
11-10-2009, 03:33 AM
|
#6
|
Senior Member
Registered: Aug 2006
Posts: 2,697
|
Quote:
Originally Posted by smeezekitty
if this isn't a server type:
Code:
sudo rm -rf /var
sudo rm -rf /tmp
sudo mkdir /var
sudo mkdir /tmp
reboot system immediately because it will be unstable until you do.
|
WTH are you trying to propose?? it doesn't matter if its server or not. removing /var like that is cause for trouble
Last edited by ghostdog74; 11-10-2009 at 03:35 AM.
|
|
|
11-10-2009, 03:48 AM
|
#7
|
Senior Member
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,461
|
Hi
If you think it's the logfiles, the proper thing would be to edit the file /etc/logrotate.conf and change it. Standard is usually weekly and rotate is 4 which means rotate the logs weekly and keep 4 weeks of logs. If you change rotate to for example 2 you should free up some disk space.
There are also files in /etc/logrotate.d/ which is settings for specific apps. If you find squid or the name of your MTA, those files would be the ones to change.
Another tip is to run these commands
cd /
du -sh *
This will take a while, but it will show you what is taking up the space. If you find there's a lot in /var, then
cd /var
du -sh *
This will show what is taking the space in /var, and so on...
|
|
|
11-10-2009, 04:45 AM
|
#8
|
Senior Member
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,013
Original Poster
Rep:
|
Quote:
Originally Posted by Disillusionist
Check for any individual large files.
The following searches for files over 50M in /var
Code:
find /var -size +50M
Additionally, search for core dumps
If you find anything that your not sure about, post here.
[EDIT]
Avoid running find on the /proc directory.
Code:
find / -path /proc -prune -o -name core -print
|
It doesn't seem that there is anything over 50M. I ran that and it just returned the prompt.
These are the core files:
Code:
[root@localhost ~]# find /var -size +50M
[root@localhost ~]# find / -name core
/lib/modules/2.6.18-92.el5/kernel/sound/core
/lib/modules/2.6.18-92.el5/kernel/net/core
/lib/modules/2.6.18-92.el5/kernel/drivers/infiniband/core
/lib/modules/2.6.18-164.2.1.el5/kernel/sound/core
/lib/modules/2.6.18-164.2.1.el5/kernel/net/core
/lib/modules/2.6.18-164.2.1.el5/kernel/drivers/infiniband/core
/lib/modules/2.6.18-164.6.1.el5/kernel/sound/core
/lib/modules/2.6.18-164.6.1.el5/kernel/net/core
/lib/modules/2.6.18-164.6.1.el5/kernel/drivers/infiniband/core
/usr/share/doc/mod_perl-2.0.4/docs/devel/core
/proc/sys/net/core
/dev/core
Here are my squid logs:
Code:
/var/log/squid/access.log
/var/log/squid/access.log.1.gz
/var/log/squid/access.log.2.gz
/var/log/squid/access.log.3.gz
/var/log/squid/access.log.4.gz
/var/log/squid/access.log.5.gz
Maybe now that there are 5, it will settle down with logrotate?
Code:
du -sh *
7.1M bin
17M boot
144K dev
94M etc
25M home
160M lib
16K lost+found
8.0K media
0 misc
8.0K mnt
0 net
7.8M opt
0 proc
128K root
31M sbin
8.0K selinux
8.0K srv
0 sys
71M tmp
985M usr
2.7G var
Code:
du -sh *
7.1M bin
17M boot
144K dev
94M etc
25M home
160M lib
16K lost+found
8.0K media
0 misc
8.0K mnt
0 net
7.8M opt
0 proc
128K root
31M sbin
8.0K selinux
8.0K srv
0 sys
71M tmp
985M usr
2.7G var
Maybe I should move var?
Last edited by qwertyjjj; 11-10-2009 at 04:48 AM.
|
|
|
11-10-2009, 04:50 AM
|
#9
|
Senior Member
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,013
Original Poster
Rep:
|
Quote:
Originally Posted by Guttorm
Hi
If you think it's the logfiles, the proper thing would be to edit the file /etc/logrotate.conf and change it. Standard is usually weekly and rotate is 4 which means rotate the logs weekly and keep 4 weeks of logs. If you change rotate to for example 2 you should free up some disk space.
There are also files in /etc/logrotate.d/ which is settings for specific apps. If you find squid or the name of your MTA, those files would be the ones to change.
Another tip is to run these commands
cd /
du -sh *
This will take a while, but it will show you what is taking up the space. If you find there's a lot in /var, then
cd /var
du -sh *
This will show what is taking the space in /var, and so on...
|
Could be this:
2.1G sarg
in /var/www/
sarg writes html files every day
Maybe they shouldn't be in /var at all but they need to be in www to be accessible from the web.
Last edited by qwertyjjj; 11-10-2009 at 05:05 AM.
|
|
|
11-10-2009, 05:52 AM
|
#10
|
Senior Member
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,461
|
Hi
I think the proper thing would be to configure sarg properly. I just installed it and looked at the config file.
Edit /etc/squid/sarg.conf
Find the line
lastlog 0
Which means keep all reports forever. Do you really need them forever? I'd change it to something like:
lastlog 4
|
|
|
11-10-2009, 06:12 AM
|
#11
|
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726
|
Quote:
Originally Posted by qwertyjjj
Maybe I should move var?
|
Do NOT remove /var. If you do your system will be close to hosed.
Find out what in /var is eating all your diskspace. eg.
Then repeat in the sub directories that are large.
Evo2.
|
|
|
11-10-2009, 08:36 AM
|
#12
|
Senior Member
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,013
Original Poster
Rep:
|
Quote:
Originally Posted by Guttorm
Hi
I think the proper thing would be to configure sarg properly. I just installed it and looked at the config file.
Edit /etc/squid/sarg.conf
Find the line
lastlog 0
Which means keep all reports forever. Do you really need them forever? I'd change it to something like:
lastlog 4
|
And this is 4 weeks?
Maybe I should keep 5 for the monthly reports.
|
|
|
11-10-2009, 01:59 PM
|
#13
|
Senior Member
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339
|
Quote:
Originally Posted by evo2
Do NOT remove /var. If you do your system will be close to hosed.
Find out what in /var is eating all your diskspace. eg.
Then repeat in the sub directories that are large.
Evo2.
|
really removing /var on a non server box has really no effect because it does nothing.
|
|
|
11-10-2009, 03:23 PM
|
#14
|
Senior Member
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,070
|
Quote:
Originally Posted by qwertyjjj
I can only assume this is from log files in the form of maillogs and squid logs.
|
In context, assuming is bad. Please try to get evidence of what is actually the problem; it will help if you don't waste time on stuff that isn't actually the problem.
What partitions do which and which of them is (are) filling up? The output of df would be helpful here.
If the problem is log files/logrotate, there is also an option to compress old log files which may be useful.
|
|
|
11-10-2009, 07:02 PM
|
#15
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,415
|
Definitely edit logrotate scripts to gzip old logs as it goes.
That's a start.
Next, determine yourself and/or with a mgr how many online logs are required. You could/should back them up to another system or storage media more frequently.
Last but not least, use the options in du to find out where the big dirs/files are and think about more backups/removals.
My basic cmd is
du / |sort -nk1
ie check specified dir and sort by size
Do NOT rm those dirs like /var /tmp ...
|
|
|
All times are GMT -5. The time now is 09:05 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|