Search code examples
diskspace

Command df -h gives 100% disk usage even when disk is not full


I am running df -h command on centos machine. It gives 100% memory used even when the disk has more than half space is empty.

Here is the output of df -h:

Filesystem                          Size  Used Avail Use% Mounted on

/dev/mapper/vg_fhnesx3bob3-lv_root   46G   44G     0 100% /
devtmpfs                             16G     0   16G   0% /dev    
tmpfs                               4.0G   80K  4.0G   1% /dev/shm    
tmpfs                                16G   65M   16G   1% /run    
tmpfs                                16G     0   16G   0% /sys/fs/cgroup    
/dev/sda1                           473M  158M  316M  34% /boot    
/dev/mapper/vg_fhnesx3bob3-lv_home  459G   35G  401G   8% /home    
//192.168.20.122/bobcat             5.4T  1.2T  4.3T  21% /mnt/abc    
tmpfs                               3.2G     0  3.2G   0% /run/user/0    
tmpfs                               3.2G  8.0K  3.2G   1% /run/user/42

And this is the output using du command:

[root@fhn-esx3-bob3 tmp]# du -hsx /
5.0G    /

Why df -h is showing wrong information is the primary concern as we are unable to run some processes due to it.


Solution

  • It seems you are seeing wrong information.

    /dev/mapper/vg_fhnesx3bob3-lv_root 46G 44G 0 100% /

    It's full but it is just one of your partition, you should see the line

    /dev/mapper/vg_fhnesx3bob3-lv_home 459G 35G 401G 8% /home

    This partition just consuming 8% of total space. To see how many partition and disk on your computer, follow these steps:

    1. First list how many partition in your computer with command:

    sudo fdisk -l

    You will see output something like this:

    Device Start End Sectors Size Type
    /dev/sda1 2048 195311615 195309568 93.1G EFI System
    /dev/sda2 195311616 196386815 1075200 525M EFI System
    /dev/sda3 196386816 1953523711 1757136896 837.9G Linux filesystem

    1. To see disk usages for each partition run command:

    df -h [device_name], example: df -h /dev/sda1

    Hope it helps