开发者_运维知识库Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this questionI seem to have hosed myself, as I was running/learning some failing PHP/MySQL data scrape script and went off to bed. I don't know if it looped or what exactly happened, but I came back and it showed disk almost full. The analyzer said I had used almost 100G of a 100G drive on a /var directory. I try du and df-ah, but it will not show where the hog is. Says, "Permission denied." for many of the directories.
Clues: 1) gdm directory is listed as recent but won't let me look inside. 2) I was running an edit program called gksudo gedit, because I could not write to /var/www files for PHP. It appears that in the ps window, a nautilus program is dormant.
Any help is greatly appreciated and I love ubuntu, but I'm pretty much a linux newbie. Thanks.
Do you have root permissions?
sudo bash
Then you can go in and look into what is going on.
cd /var
du -s *
Oh, and I hope I don't have to mention that you should not delete stuff that you didn't create yourself. You might just delete something important.
You report that /var/log/apache seems "large". I do NOT recommend simply deleting the files. Instead, if you are very very sure that no-one will ever need to see any historical archives of the errors and accesses made, you can:
cd /var/log/apache
for f in *; do > $f; done
which will truncate the files. This will make it less likely to cause problems due to non-existant files or bad permissions or required rotation signaling. If you might need these files in the future, we could talk about using logrotate to try and save them.
The filesystem permissions require root access to read many of the directories in /var
:
ls -l /var
...
drwx--x--x 3 root root 4096 2011-04-04 23:13 www
You just need root privileges to read them all:
sudo -s
cd /var/www
ls -l
Be careful running with a root shell. You can make a ton of mistakes really quickly, some might be difficult to undo. :)
精彩评论