Understanding Results from df and du commands

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Understanding Results from df and du commands
# 1  
Old 04-03-2013
Understanding Results from df and du commands

Good day every one.
When a use df -h comand on my read hat linux server i get something like this:

/dev/mapper/Vg02-Lv19 30G 29G 145M 100% /app

Then when i do du -sh /app/
i get
12G /app/
For me it is meaning that only 12G was used on /app partition.
How can i see where are being used other 18G?

best Regards
Gege
# 2  
Old 04-03-2013
They are probably in deleted files.

Naively deleting busy or open files will cause them to not be listed, yet still stored on disk; they will remain stored until whatever is holding them open closes them or quits.
# 3  
Old 04-03-2013
There's a difference between the file size in bytes as displayed by e.g. ls, and the space allocated on disk, today usually multiples of 4k. Use ls -s to get a feeling for the two, and the difference. But, to explain such a huge discrepancy (12 GB as opposed to 18 GB), this would not normally suffice, except if you had a really really large number of really small files.

Corona668's suspicion is a very good candidate; use lsof /app and search for "(deleted)" entries:
Code:
firefox    2287 cxxr   36r   REG    8,8     6184 374670 .local/share/gvfs-metadata/root (deleted)

This User Gave Thanks to RudiC For This Post:
# 4  
Old 04-03-2013
It seems you have "sparse" files in your filesystem. Those files shows significantly different sizes in [du -sh filename] & [ ls -lh filename ] outputs.

Start with finding files which are more than 1 MB and do a "ls -lh" and "du -sh" on those files. If you find any file which shows 1 MB in one output and 1 GB in another output - there is the culprit. Smilie

Hope this helps. Read more on sparse files on wikipedia or some good website and that will give you more insight about these type of files.
# 5  
Old 04-03-2013
Quote:
Originally Posted by freebird8z
It seems you have "sparse" files in your filesystem. Those files shows significantly different sizes in [du -sh filename] & [ ls -lh filename ] outputs.
A sparse file could use less disk than its length, but never more.
# 6  
Old 04-03-2013
Yes, sparse files would show the reverse effect. That's why I did not mention them above.
# 7  
Old 04-04-2013
Hi RudiC
The lsof command is not working for me
.
[oracle@zambezi udump]$ lsof /app
-bash: lsof: command not found
[oracle@zambezi udump]$

regards
Gege
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

I want to add a variable for the results from the formula of one variable and results of another var

Good morning all, This is the file name in question OD_Orders_2019-02-19.csv I am trying to create a bash script to read into files with yesterdays date on the file name while retaining the rest of the files name. I would like for $y to equal, the name of the file with a formula output with... (2 Replies)
Discussion started by: Ibrahim A
2 Replies

2. Shell Programming and Scripting

Can ctag and cscope support recording search results and displaying the history results ?

Hello , When using vim, can ctag and cscope support recording search results and displaying the history results ? Once I jump to one tag, I can use :tnext to jump to next tag, but how can I display the preview search result? (0 Replies)
Discussion started by: 915086731
0 Replies

3. AIX

HACMP: difference between 'cl' commands and 'cli' commands

Hi all, I'm new in this forum. I'm looking for the difference between the HACMP commands with the prefix "cl" and "cli". The first type are under /usr/es/sbin/cluster/sbin directory and the second are under /usr/es/sbin/cluster/cspoc directory. I know that the first are called HACMP for AIX... (0 Replies)
Discussion started by: peppix
0 Replies

4. UNIX for Dummies Questions & Answers

Why do these 2 find commands return different results?

Hi, I am using the korn shell on Solaris box. Why does the following 2 commands return different results? This command returns no results (I already used this command to create a list of files which I moved to an archive directory) find ????10??_*.dat -type f -mtime +91 However this... (15 Replies)
Discussion started by: stumpy1
15 Replies

5. UNIX for Dummies Questions & Answers

understanding {%/*}/

Hi Gurus: I am trying to understand the following line of code.I did enough of googling to understand but no luck.Please help me understand the follow chunk of code: X=$0 MOD=${X%/*}/env.ksh X is the current script from which I am trying to execute. Say if X=test.ksh $MOD is echoing :... (3 Replies)
Discussion started by: vemana
3 Replies

6. UNIX for Dummies Questions & Answers

Output results of multiple commands to a file

Hi I want to output the results of multiple commands to a single file. I use simple Ping, telnet commands to check the connectivity to many servers. Can i execute all the commands and write the output to a file instead of executing them one by one? Thanks Ashok (2 Replies)
Discussion started by: ashok.k
2 Replies

7. Shell Programming and Scripting

Help in understanding the following commands

Hi , Please help me in understanding the below commands temp="$dirname.temp.cc.$$" This will eliminate any trailing white spaces??? k=$(grep -cvE " |\+|-|0|1|\f" $temp if (substr(file,2,24) ~ /{13,}/) {print "N" file} -- this is inside an awk script (4 Replies)
Discussion started by: justchill
4 Replies

8. Filesystems, Disks and Memory

Understanding sfdisk and df results

Hi, Using fdisk I created a partition of 15.7 GB. I entered +15700M Using sfdisk there is a heading called blocks and there is a number which is approximatly 400 BM less. When I mount the partition and use df -l the 1K block column displays only 15GB! I need to understand these numbers if... (2 Replies)
Discussion started by: mojoman
2 Replies

9. Shell Programming and Scripting

Can BASH execute commands on a remote server when the commands are embedded in shell

I want to log into a remote server transfer over a new config and then backup the existing config, replace with the new config. I am not sure if I can do this with BASH scripting. I have set up password less login by adding my public key to authorized_keys file, it works. I am a little... (1 Reply)
Discussion started by: bash_in_my_head
1 Replies

10. Programming

code that reads commands from the standard i/p and executes the commands

Hello all, i've written a small piece of code that will read commands from standard input and executes the commands. Its working fine and is execting the commands well. Accepting arguments too. e.g #mkdir <name of the directory> The problem is that its not letting me change the directory i.e... (4 Replies)
Discussion started by: Phrozen Smoke
4 Replies
Login or Register to Ask a Question