4

When I use df -h it gives following result for /appl directory

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

But when I enter that directory cd /appl and run du -sh it is giving me the following result :

 4.9G   .

If the /appl mountpoint is occupied 32GB why is it showing that it's directories total to 4.9G?

10
  • Are you running it as root? Are you including "hidden" dot files? askubuntu.com/questions/356902/… Jun 11, 2015 at 5:34
  • @TessellatingHeckler No , I am not running as root.Talking about the hidden files how do I include hidden files in my result?
    – user1
    Jun 11, 2015 at 5:38
  • 1
    This looks somewhat convincing: superuser.com/a/868800/67909 and run it with sudo. Jun 11, 2015 at 5:47
  • Show the output of the mount command
    – Santosh A
    Jun 11, 2015 at 6:01
  • @SantoshA result of mount|grep appl is shown below: /appl on /appl read/write/setuid/dev=524138f on Fri Jun 28 22:01:34 2013
    – user1
    Jun 11, 2015 at 6:13

2 Answers 2

3

Firstly df and du are two completely different linux utilities.

df = Disk free
du = Disk usage

df (More info on df) will read the meta data of the disk partition containing the specified folder which in your case is app1 and return the disk partition information rather than that of the actual directory.

But du(More info on du) will runs through the directory tree specified and counts the sum size of all the files under the directory and return the total space occupied by that directory.

Next to answer your question:
cd /appl or cd <mount_point> is not possible.
To check where is the partition app1 mounted use mount command.

The confusion you see is because there must be a folder called app1 under / directory and also a partition named app1.

Once you locate the mount point of the app1 partition, cd to that directory and then run du -sh the expected output should be 32G after taking some time.

Note : app1 partition mount point and /app1 are not same.

6
  • Excellent coverage on the differences between the two, but how frequently would they differ as significantly as OP is seeing without some other contributing factor?
    – Anthony
    Jun 11, 2015 at 5:56
  • 1
    @Anthony :Thanks. I have updated my answer now to be more specific to OP's question.
    – Santosh A
    Jun 11, 2015 at 6:01
  • @SantoshA As I ran the command mount|grep appl I got /appl on /appl read/write/setuid/dev=524138f on Fri Jun 28 22:01:34 2013 Does this not means that the mountpoint and the directory refer to the same thing?
    – user1
    Jun 11, 2015 at 11:51
  • With this /appl on /appl it does mean that mount point and directory are the same. But I think that is not possible. A folder mounted onto itself which I am not aware? Which OS/System are you using ? Can you give the specific's?. On a general desktop, a disk/block device is mounted to a folder which appears like this /dev/sda2 on /home type ext4 (rw). But in your case this is totally different
    – Santosh A
    Jun 11, 2015 at 12:04
  • @SantoshA OS details uname -a gives SunOS efssapp09 5.9 Generic_Virtual sun4u sparc sun4v
    – user1
    Jun 11, 2015 at 12:09
0

At first, you should know the different between du and df. Wikipedia says

du is to display the file space allocated to each file

df display the amount of available disk space for file systems on which the invoking user has appropriate read access

So, there are several possible reasons for this to happen

A few examples

  1. Some application still open deleted file, check through lsof +aL1
  2. Files larger than their true size. This will fool du, but not df
  3. if there are files at the mount point before something mounts to the mount point, those files will be hidden to du, check through debugfs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.