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?

user1
  • 336
  • 1
  • 6
  • 17
  • Are you running it as root? Are you including "hidden" dot files? http://askubuntu.com/questions/356902/why-doesnt-this-show-the-hidden-files-folders – TessellatingHeckler Jun 11 '15 at 05: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 '15 at 05:38
  • 1
    This looks somewhat convincing: http://superuser.com/a/868800/67909 and run it with `sudo`. – TessellatingHeckler Jun 11 '15 at 05:47
  • Show the output of the `mount` command – Santosh A Jun 11 '15 at 06: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 '15 at 06:13
  • Have you checked this question: http://stackoverflow.com/questions/24671621/no-space-left-on-device – VolenD Jun 11 '15 at 07:28
  • What is the result of this command `du -shc .[!.]* *` in the `appl` folder – Santosh A Jun 11 '15 at 09:15
  • @SantoshA It is not supporting the -c option for du – user1 Jun 11 '15 at 09:20
  • @user1: Okay : What is the result without that option(`-c`)? – Santosh A Jun 11 '15 at 09:21
  • @SantoshA Kindly find the result below: `0K .[!.]*` `141M FDT` `215M FDTCST` `634M FGM` `3.0G FGMCST` `196M HITENDRA` `124M OSD` `224K SUNWj5dmx` `1.6M SUNWj5dvx` `22M SUNWj5rtx` `160K flstr` ` 520M fmon` `163M jdk1.5.0_16` ` 0K lost+found ` – user1 Jun 11 '15 at 09:26

2 Answers2

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.

Santosh A
  • 5,173
  • 27
  • 37
  • 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 '15 at 05:56
  • 1
    @Anthony :Thanks. I have updated my answer now to be more specific to OP's question. – Santosh A Jun 11 '15 at 06: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 '15 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 '15 at 12:04
  • @SantoshA OS details `uname -a` gives `SunOS efssapp09 5.9 Generic_Virtual sun4u sparc sun4v` – user1 Jun 11 '15 at 12:09
  • @user1: One more query, can you share the output of `cat /etc/vfstab` and `mount -p`? – Santosh A Jun 11 '15 at 12:18
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
DreamOneX
  • 21
  • 2