The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
getting results after using ps command yale_work Shell Programming and Scripting 11 10-07-2008 05:13 PM
Iteration through the results from a unix command deviprasad83 Shell Programming and Scripting 4 06-12-2008 05:04 AM
Setting the Results of a Command to a Variable stky13 UNIX for Dummies Questions & Answers 1 02-29-2008 03:00 PM
edit results of a find command grep_whoami Shell Programming and Scripting 6 10-15-2007 07:16 PM
Command for showing IP Address danhodges99 UNIX for Dummies Questions & Answers 7 08-23-2002 09:00 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-14-2009
ameya_joshi ameya_joshi is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 3
df and du command showing different results

I recently encountered this on the AIX system

df command showed usage is 100% i.e 1.5 GB while du command showed usage is only 500MB

Why are the 2 commands showing different output

This command shows usage is 1.5 GB

nlxdsm29:deqadm 24> df -k .
/usr/sap/DEQ (/dev/vgdeq_1/lv_sap ) : 1560576 total allocated Kb
0 free allocated Kb
1560576 used allocated Kb
100 % allocation used
while this command shows usage is just 500MB

nlxdsm29:deqadm 28> *du -sk |sort -nr|head -10
457613 data
24285 log
689 work
51 sec

Also a process was using space on this directory

/usr/sap/DEQ: 12349co(deqadm) 12374co(deqadm) 12358co(deqadm) 12348co(deqadm)


My senior told me that may be the process was writing to a file on this directory . The file must have been deleted for freeing up the space but as the file handle was open the space could not be freed up as reflected in df command

I could nt understand it .

So can anybody explain this different behaviour of commands
  #2 (permalink)  
Old 06-14-2009
jlliagre jlliagre is online now Forum Advisor  
ɹǝsn sıɹɐlosuǝdo
  
 

Join Date: Dec 2007
Location: Paris
Posts: 1,452
Your "senior" is right. A deleted file isn't really as long as a process or more are still using it.

You need to wait for these processes to die or even kill them if that doesn't hurt to see the free space made available again.
  #3 (permalink)  
Old 06-14-2009
ameya_joshi ameya_joshi is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 3
See in Windows you cant delete file which is being accessed

I dont know about Unix

As a novice am thinking the file is deleted hence the space is freed up and should be reflected in df command

this "process" concept am really not getting

can u plz explain as if u r explaining to a Unix newbie
  #4 (permalink)  
Old 06-15-2009
jlliagre jlliagre is online now Forum Advisor  
ɹǝsn sıɹɐlosuǝdo
  
 

Join Date: Dec 2007
Location: Paris
Posts: 1,452
A process is a running program.

In windows, you indeed can't delete a file being accessed, which is a major design issue in my opinion. This is one of the reasons why you need to reboot windows that much after administrative actions with which Unix would have stayed up.

Under Unix, you can delete a file being accessed. This file disappears from the directory so its content become unreachable. However, the programs that have it open at the deletion time can still read and write data to it until they die and the space is actually freed.
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:45 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0