2

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?

1

1 Answer 1

4

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

5
  • 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
    Commented Jun 21, 2013 at 9:11
  • 1
    @SimonBS: Rather than deleting log files and the like, rotate them properly. Commented Jun 21, 2013 at 9:15
  • @SimonBS, look for the logrotate package.
    – kostix
    Commented Jun 21, 2013 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
    Commented Jun 21, 2013 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 Commented Jun 21, 2013 at 15:31

You must log in to answer this question.

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