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,210
  • 3
  • 25
  • 33
Shadin
  • 263
  • 3
    Your disk is full. What makes you believe it isn't? Boot into recovery and remove some files. After you get the system up, use du or ncdu to see what files are eating all your space. For servers I highly recommend monitoring applications for disk space to prevent system outage. – gertvdijk Jan 01 '13 at 17:43
  • Free monitoring software, xymon: http://xymon.sourceforge.net/ –  Jan 01 '13 at 17:47
  • Is that a remote server? If you can still access it please post the results of df -h and du -s /* so that we can assist with finding the "lost" space. – guntbert Jan 01 '13 at 18:20
  • 1
    "Is there anyway to save me and my server without a format ?" Who gave you the idea that a full disc requires a format of a disc? – Rinzwind Jan 01 '13 at 20:40
  • 1
    Updated my Post – Shadin Jan 02 '13 at 15:43
  • This should now be closed as 'Too localized' since the problem disappeared and any answers can't be tested. Your follow-up question in the new edit is a duplicate of this one. Good luck & post again if you have any new problems. – Tom Brossman Jan 06 '13 at 07:07
  • @TomBrossman The answer is quite good, and is applicable to others. This question is effectively resolved, and there is no need to close it as too localized. Furthermore, even if this had no answers, we would still wait more than 5 days to close it as abandoned! The vast majority of questions that we close as too localized because they're abandoned have no useful answers and are months or years old. – Eliah Kagan Jan 07 '13 at 00:24
  • @EliahKagan Fair enough. It's only got two close-votes now, and I see from the most recent edit that the problem has recurred. It might even be good to merge with this closely related question, which has some great information. – Tom Brossman Jan 07 '13 at 06:56

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.