Df and du give different results

When I use df -h

it gives the following output for the directory/appl

/appl                   39G    32G   6.7G    83%    /appl

      

But when I enter this directory cd /appl

and run du -sh

it gives me the following output:

 4.9G   .

      

If the mount point / appl is 32GB, why is it showing that its directories are only 4.9G?

+3


source to share


1 answer


First, df

and du

are two completely different linux utilities.

df = Disk free


du = Disk usage

df

( More info on df ) will read meta data

disk partition

containing the specified folder, which in your case is what app1

returns disk partition information

, not the actual directory.

But du

( more info on du ) will go through the specified directory tree and calculate the size of the sum of all files under and return total space occupied by that directory

.



Next to the answer to your question:
cd /appl

or cd <mount_point>

not.
To check where the partition is installed app1

use the command . mount

The confusion you see is that there /

must be a folder named in the directory app1

as well as a section named app1

.

Once you find mount point

the app1 section cd

in that directory and then run du -sh

, the expected output should be 32G

after a while.

Note. app1

the mount point of the partitions and /app1

do not match.

+3


source







All Articles