Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently discovered that I only had a very small amount of disk space left. I found that my logs were getting quite huge so I reconfigured logrotate. However, I still have some issues. Using df -h I can see that I have used 13 GB and have 6 GB left.

root@host01:/# df -h
Filesystem                 Size  Used Avail Use% Mounted on
rootfs                      20G   13G  6.3G  67% /
udev                        10M     0   10M   0% /dev
tmpfs                       50M  156K   50M   1% /run
/dev/disk/by-label/DOROOT   20G   13G  6.3G  67% /
tmpfs                      5.0M     0  5.0M   0% /run/lock
tmpfs                      100M     0  100M   0% /run/shm

However, if I go to the root / and do du -h --max-depth=1 | sort -h it shows that roughly 6 GB is used.

root@host01:/# du -h --max-depth=1 | sort -h
du: cannot access `./proc/8902/task/8902/fd/5': No such file or directory
du: cannot access `./proc/8902/task/8902/fdinfo/5': No such file or directory
du: cannot access `./proc/8902/fd/5': No such file or directory
du: cannot access `./proc/8902/fdinfo/5': No such file or directory
0   ./dev
0   ./proc
0   ./sys
4.0K    ./lib64
4.0K    ./media
4.0K    ./mnt
4.0K    ./opt
4.0K    ./selinux
8.0K    ./tmp
12K ./srv
16K ./lost+found
104K    ./root
156K    ./run
5.9M    ./sbin
6.9M    ./bin
8.2M    ./etc
15M ./boot
121M    ./lib
332M    ./var
851M    ./usr
5.0G    ./home
6.3G    .

It seems odd that I should have used 13 GB and the total usage of the root shows 6,3 GB which seems a bit more reasonable. Does anyone know where the other 7 GB might be located and if I can restore any of it?

share|improve this question
    
See also. – kostix Jun 21 '13 at 9:16
up vote 4 down vote accepted

It's likely unlinked files that are still held open by one or more programs. One sure way to clear this space -- reboot.

share|improve this answer
    
That was it. Thank you very much! Do you know what is the best way to avoid this? Is it simply rebooting the system once in a while? Maybe with a cronjob to do it every night. – SimonBS Jun 21 '13 at 9:11
1  
@SimonBS: Rather than deleting log files and the like, rotate them properly. – David Schwartz Jun 21 '13 at 9:15
    
@SimonBS, look for the logrotate package. – kostix Jun 21 '13 at 9:17
    
Okay. I think it is setup correctly then. I configured logrotate to only store logs for a few days and then I deleted all previous logs. That's probably what caused problems. Thanks. – SimonBS Jun 21 '13 at 9:21
    
@SimonBS You shouldn't need to do anything as drastic as rebooting; you just need to restart the process responsible. I have written a complete explanation in my blog: linuxtech.ie/wordpress/2012/10/31/missing-disk-space-linux-unix – Philip Kearns Jun 21 '13 at 15:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .