Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
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.
It's not really that big (about 400M at the moment) but sometimes it needs a lot of space, for instance apt-get upgrade (Debian system) can download as much as 500 or 600M of .deb files. These can be cleaned up once the upgrade is done but it needs the space with it is doing the upgrade.
crashedagain@desktop:~$ sudo du -s /var
most of it is in /var/lib & /var/log:
crashedagain@desktop:~$ sudo du -s /var/*
most of /var/lib is apt & dpkg but there are a couple of really big files in /var/log:
crashedagain@desktop:~$ ls -ls /var/log | sort -n
3436 -rw-r----- 1 root adm 3514197 Oct 20 06:33 syslog.2.gz
6556 -rw-r----- 1 root adm 6698794 Oct 20 06:33 messages.0
60720 -rw-r----- 1 root adm 62108905 Oct 20 04:54 debug.0
68892 -rw-r----- 1 root adm 70467752 Oct 20 06:25 kern.log.0
If I can get rid of these (and set the system up to keep them from growing...130Meg in log files is ridiculous!) then var will be small enough it won't be worth moving. I think logrotate is what cleans them up but I haven't figured out how it works yet.
It will rotate the logs weekly, keep 1 week worth of old logfiles, create new (empty) logfiles upon rotation and compress the old logs. In addition there might be some additional settings for certain logfiles in /etc/logrotate.d. They mainly deal with what happens when a certain logfile gets rotated (a bit like the part for wtmp above). Probably all you need to touch is /etc/logrotate.conf. Also make sure that logrotate gets run by cron (i.e. your machine is up at the time of the cronjob).
Oh, and check the logging settings of your firewall, it can quite quickly bloat the logs, could be the reason for the size of your kern logfile. What goes into debug in your system?
That's pretty much what mine looks like too except I had rotate 5 so I had 5 .gz compressed old files for most logs instead of 1.
But the 60+ Meg files debug.0 and kern.log.0 were dated Oct 20 so why weren't they rotated? Does rotate work on ALL log files in /var/log or is it necessary to specify which ones get rotated? The manpage doesn't say.
I manually removed them & recreated empty files so as to avoid something looking for them & giving an error.
Drive space is probably OK now:
Filesystem Size Used Avail Use% Mounted on
/dev/hda8 4.2G 2.6G 1.4G 67% /
/dev/hda1 4.6G 3.0G 1.6G 66% /mnt/hda1
/dev/hda5 3.0G 791M 2.1G 28% /home
/dev/hda7 26G 8.9G 17G 36% /mnt/hda7
/dev/hdb1 25G 301M 23G 2% /mnt/hdb1
/dev/hdb2 50G 20G 28G 42% /mnt/hdb2
hda1 is windows, hda7 is vfat & hdb is a data drive. but with 1.6G free on hda8 I should be OK, Previously I had about 90% full on this drive.
You probably shouldn't move /root to a new partition. The reason /root is put on the root filesystem is so that if there's a boot problem and Linux is unable to mount any other partitions besides the root partition, then root can still get to all his files. If /root is on a separate partition, he'll still be able to log in in that case, but won't have any access to files in his home dir.