Unable To Find The Used Space

Home » CentOS » Unable To Find The Used Space
CentOS 6 Comments

Hi,

While checking with df -h, it’s showing the used space is 94% on root (/). If checked with du -sh, it’s not showing the used space.

# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 7.8G 0 7.8G 0% /dev tmpfs 7.8G 0 7.8G 0% /dev/shm tmpfs 7.8G 857M 7.0G 11% /run tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/CentOS-root 50G 47G 3.4G 94% /
/dev/mapper/CentOS-home 241G 47G 195G 20% /var/log
/dev/sda1 1014M 189M 826M 19% /boot tmpfs 1.6G 0 1.6G 0% /run/user/0
tmpfs 1.6G 0 1.6G 0% /run/user/1002

# du -sh /*
0 /bin
156M /boot
0 /dev
33M /etc
388K /home
0 /lib
0 /lib64
0 /media
0 /mnt
0 /opt du: cannot access ‘/proc/21489/task/21489/fd/4’: No such file or directory du: cannot access ‘/proc/21489/task/21489/fdinfo/4’: No such file or directory du: cannot access ‘/proc/21489/fd/4’: No such file or directory du: cannot access ‘/proc/21489/fdinfo/4’: No such file or directory
0 /proc
6.1M /root
857M /run
0 /sbin
0 /srv
0 /sys
0 /tmp
2.8G /usr
62G /var

# du -sh /var/*
0 /var/adm
89M /var/cache
0 /var/crash
8.0K /var/db
0 /var/empty
0 /var/games
0 /var/gopher
0 /var/kerberos
16G /var/lib
0 /var/local
0 /var/lock
47G /var/log
0 /var/mail
0 /var/nis
0 /var/opt
0 /var/preserve
0 /var/run
98M /var/spool
0 /var/tmp
499M /var/www
0 /var/yp

How can i find this hidden space?

BR, Sachchidanand

6 thoughts on - Unable To Find The Used Space

  • Use ‘du -xh –max-depth=1 /’ it will clean up your output and show you only things on the root partition.

    And as someone else said, deleted but open files are not removed until the file handle is closed. This is used by some applications to “hide”
    totally temporary files. Do ‘lsof | grep delete’ to see such files.
    (This technique is also used by malware to hide their files.)

    P.

  • As an addition to what others have already said. You’ll also miss things “hidden under mounts”. That is, if you had 5G in /var/log on the root file system and then mounted a different device on /var/log, then that 5G would still be there but invisible.

    Also, /dev/mapper/CentOS-home, HOME?!, on /var/log?

    /Peter

  • Note the reason for -x .
    -x is equivalent to –one-file-system . It says that when searching from a directory, include only descendants in the same filesystem.

    Though rather unlikely, it is possible that none of /*
    are in the same filesystem as / , hence the need for / rather than /* .

  • as /dev, /proc, and /sys are mounted on nearly every linux system, and those are places you don’t want du poking around, you do need to avoid that.

  • Peter Kjellström wrote:

    What I usually do in cases like this, is to bind mount root to somewhere else – and then run ‘du’ or whatever using the bind mount point – this will show up any ‘hidden under mounts’ data – something like:

    mkdir /var/run/mnt
    mount –bind / /var/run/mnt
    du -sh /var/run/mnt/*

    James Pearson