LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Hard drive space management. (https://www.linuxquestions.org/questions/linux-server-73/hard-drive-space-management-842627/)

aaab 11-05-2010 04:47 PM

Hard drive space management.
 
Hi,

I have a web server running centos. The hard drive just keeps filling up by about 1-2G a day, and I can't figure out whats using the space.


Filesystem Size Used Avail Use% Mounted on
/dev/sda1 24G 17G 5.7G 75% /
tmpfs 250M 0 250M 0% /dev/shm
/dev/sdb1 15G 319M 14G 3% /storage


My site is stored in /var/www/html

[root@centos www]# pwd
/var/www
[root@centos www]# du -h | grep -v ./
74M .
[root@centos www]#

du -h is showing the i'm using 74M in /var/www

[root@centos log]# pwd
/var/log
[root@centos log]# du -h | grep -v ./
2.2M .


Logs are only showing 2.2M

So either du isn't working or I am using it wrong...


[root@centos log]# cd /
[root@centos /]# du -h | grep -v ./
2.5G .

So maybe the file thats taking up the space is undetectable by du?

SciFi-Bob 11-05-2010 09:31 PM

Have you ever tried this:

du -sh /*

To see what root folders occupy the space?

udaman 11-05-2010 10:10 PM

You may find that /var/log is the culprit. I always suspect a runaway log file when my root disk fills to capacity. I've seen 'sar' files bring down a RedHat system more than once.

aaab 11-05-2010 11:11 PM

How is du -h /* different to running du -h in / ?

Yea it probably is /var/log but I can't see anything in there taking up space.

tommylovell 11-06-2010 12:09 AM

If it's one large file or a few large files, "du -kSx | sort -rn | less" will catch it.

If it is an accumulation of small files, you may have better luck if you drop the 'S' and try "du -kx | sort -rn | less"

Opinion:
I think 'du' and 'ls' see almost everything. The exception, files in directories that have had filesystems mounted over them.
E.g. You put a file 'bigfile' in directory /example, then you 'mount /dev/sdd4 /example'. 'ls' can no longer see 'bigfile'; and 'du' can no longer see it either. 'df' will accurately reflect the space occupied by 'bigfile'. When you 'umount /dev/sdd4', 'bigfile' will again be accessible. I just mention this in passing. This would not be your problem.


All times are GMT -5. The time now is 04:15 AM.