6

I have Ubuntu 12.04 which serves my web application (20 MB) on apache httpd. Here is my partitions table:

$ sudo parted -l

Disk /dev/sda: 500GB
Partition Table: gpt

Number|Start|End|Size|File System|Name|Flag
1|17.4K|20.0MB|20.0MB|fat16| |boot
2|20.0MB|489GB|489GB|ext4
3|489GB|500GB|10.6GB|linux-swap(v1)

A few days ago I upgrade it to 12.10. Then copied one folder (30 GB) to www folder. Suddenly the server hang and I got a Low Graphics Mode message. I removed the huge folder and restarted the computer but still got the same message and No Space Left on Device

$ sudo du -h /var --max-depth=1

4.0K  /var/tmp
235M  /var/www
444G  /var/log

So, the /var/log is huge.

I tried:

$ sudo apt-get autoclean;sudo apt-get autoremove
**Error! No space left on device**

I did delete the archives logs but nothing changes the largest file is /var/log/cups and when I list its files, I got:

-rw-r----- 1 root adm 758 DEC 30 07:37 access_log.1.gz
..
**-rw-r----- 1 root adm 444G JAN 5 08:09 error_log**
-rw-r----- 1 root adm 245 DEC 29 13:17 error_log.1.gz

I tried:

$ sudo service cups stop
sudo: unable to write to /var/lib/sudo/username/tty2: No space left on device

When I unplugged the computer then replugged it. it works fine and problem gone. The /var size is completely normal.

I'm afraid of facing it again. I think my main problem is because of the partitions. The /home and /root are together and not separated. Do I have to create a new partition for /home? Anyone has another idea how to avoid the disk from filling up again?

Pro Backup
  • 3,248
Shadin
  • 263

1 Answers1

8

As you noticed yourself, your log folder is huge. You probably want to delete some old logs. Old logs are being archived periodically. If you look into your log folder by

cd /var/log
ls -lh

you will see a lot of files ending in .gz. Those files are the archives logs. They have a number before that indicating how old the archive is. .1.gz is the newest. If you are sure you don't need the old logs any more, delete them:

sudo rm *.gz

Before you do so you might want to check why your logs are that huge. Take a look which log files and corresponding archives are huge. If you find some look into them. What are the log entries? Are some of them very frequent? What process/program/event is responsible? Can you safely lower the log level for that?

EDIT

Look into the error_log. You should use tail for showing the last few lines and hope that it can process such a huge file. You could also delete that file to free up the space but we should find out why it is that big.