Computer Forum  

Go Back   Computer Forum > Computer Operating Systems Forums > Linux Forum > Debian Linux Forum

Debian Linux Forum Debian Linux Forum


df - disk space - gives incoorect value

Debian Linux Forum

Debian Linux Forum


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-07-2009, 01:03 PM
John
Guest
 
Posts: n/a
John RSS Feed
df - disk space - gives incoorect value

Hi

I had reached 100% disk usage due to growth of some log files.

I deleted several large log files but 'df' still says 100% used.

Any idea why?

Regards
John


Reply With Quote
  #2 (permalink)  
Old 10-07-2009, 01:20 PM
Lew Pitcher
Guest
 
Posts: n/a
Lew Pitcher RSS Feed
df - disk space - gives incoorect value

On October 7, 2009 09:03, in alt.os.linux.debian, John (john1949@yahoo.com)
wrote:


I bet you deleted some of the logs that syslogd updates, right?
If so, recycle syslogd (shut it down and restart it).

You see, in Linux, the space used by a file isn't made available until all
hardlinks to that file have been deleted AND all processes that use the
file have closed it. The files used by syslog are held open as long as
syslog is running. Thus, you can delete the fileNAME all you want, but the
FILE won't delete until you shut down syslog.


--
Lew Pitcher

Master Codewright & JOAT-in-training | Registered Linux User #112576
http://pitcher.digitalfreehold.ca/ | GPG public key available by request
---------- Slackware - Because I know what I'm doing. ------


Reply With Quote
  #3 (permalink)  
Old 10-07-2009, 01:32 PM
J G Miller
Guest
 
Posts: n/a
J G Miller RSS Feed
df - disk space - gives incoorect value

On Wed, 07 Oct 2009 14:03:54 +0100, John wrote:


Remember also that df reports the "available" disk space, and that
some disk space is reserved for use only by root. So root can
fill up more of the disk space even when df reports that it is
at 100%.

Hence even if you delete some files, the df usage may not change
from 100%.

Reply With Quote
  #4 (permalink)  
Old 10-07-2009, 02:25 PM
Anton Ertl
Guest
 
Posts: n/a
Anton Ertl RSS Feed
df - disk space - gives incoorect value

"John" <john1949@yahoo.com> writes:

The daemons writing to these files still have them open, so these
files are still there. You have to stop these daemons and restart
them. In the future, the way to delete the data without stopping the
daemons is:

echo -n >logfile

- anton
--
M. Anton Ertl Some things have to be seen to be believed
anton@mips.complang.tuwien.ac.at Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html
Reply With Quote
  #5 (permalink)  
Old 10-07-2009, 02:50 PM
Lew Pitcher
Guest
 
Posts: n/a
Lew Pitcher RSS Feed
df - disk space - gives incoorect value

On October 7, 2009 10:25, in alt.os.linux.debian, Anton Ertl
(anton@mips.complang.tuwien.ac.at) wrote:


Nope. That's as bad or worse than
rm logfile

The command
echo -n >logfile
simply
a) unlink(2)s the current file named "logfile", and
b) creat(2)s a new file named "logfile"
it does not cause any processes that have the inode for the old "logfile"
open to switch to the inode for the new "logfile".

Instead of seeing that the logfile doesn't exist and freespace hasn't
returned, you see that the logfile exists, is empty, and the
freespace /still/ hasn't returned.

No. The only way to free up filespace allocated to an open file with no
filenames (i.e. a "deleted" file) is to cause all processes that have the
file open to close it.


--
Lew Pitcher

Master Codewright & JOAT-in-training | Registered Linux User #112576
http://pitcher.digitalfreehold.ca/ | GPG public key available by request
---------- Slackware - Because I know what I'm doing. ------


Reply With Quote
  #6 (permalink)  
Old 10-07-2009, 02:56 PM
John
Guest
 
Posts: n/a
John RSS Feed
df - disk space - gives incoorect value


"Lew Pitcher" <lpitcher@teksavvy.com> wrote in message
news:8e2aa$4acc95aa$cef8a40f$30022@TEKSAVVY.COM...


Hi

OK. The only deamon I can find is rsyslog. I'm Debian Lenny.

So I
/etc/init.d/rsyslog stop
then
/etc/init.d/rsyslog start

but the usage is still 100%.

Regards
John


Reply With Quote
  #7 (permalink)  
Old 10-07-2009, 03:17 PM
Anton Ertl
Guest
 
Posts: n/a
Anton Ertl RSS Feed
df - disk space - gives incoorect value

Lew Pitcher <lpitcher@teksavvy.com> writes:

[a4:/tmp:41248] echo foo >a
[a4:/tmp:41249] ln a b
[a4:/tmp:41250] echo -n >a
[a4:/tmp:41251] cat b
[a4:/tmp:41252] ls -l a b
-rw-r--r-- 2 anton users 0 Oct 7 17:16 a
-rw-r--r-- 2 anton users 0 Oct 7 17:16 b

a and b are still the same file (note the link count in addition to
size and content), so no unlink() and creat() has happened, just a
truncation.

That's with bash, maybe some other shells implement ">" in the way you
describe. To be sure, one can make the test I made.


No, it's still the same file and the same inode, there is just no more
data in it; and of course all the space formerly consumed by that data
is available again.

- anton
--
M. Anton Ertl Some things have to be seen to be believed
anton@mips.complang.tuwien.ac.at Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html
Reply With Quote
  #8 (permalink)  
Old 10-07-2009, 06:06 PM
Unruh
Guest
 
Posts: n/a
Unruh RSS Feed
df - disk space - gives incoorect value

"John" <john1949@yahoo.com> writes:





Yes. You deleted an open file. While the file name is deleted, so
nothing else can reference the file, the program ( eg syslogd) that has
the file open refers to it by inode, and that is still open. What you
need to do is to restart all programs that have those files open after
deleting them. If you look into /etc/logrotate.d you will see things
like (/etc/logrotate.d/syslog)


postrotate
[ -f /var/run/syslog-ng.pid ] && kill -HUP `cat
/var/run/syslog-ng.pid` || true
[ -f /var/run/syslogd.pid ] && kill -HUP `cat
/var/run/syslogd.pid` || true

which kills with a a signal that tells syslogd to shut and reopen any
log file it has open. That is to release the inodes.






Reply With Quote
  #9 (permalink)  
Old 10-07-2009, 06:08 PM
Unruh
Guest
 
Posts: n/a
Unruh RSS Feed
df - disk space - gives incoorect value

"John" <john1949@yahoo.com> writes:









Then you have to give us more infomation. Which files were they that
had huge amounts of data in them that you deleted?
Note, rsyslog is NOT the only daemon you have running.

Reply With Quote
  #10 (permalink)  
Old 10-07-2009, 06:51 PM
John
Guest
 
Posts: n/a
John RSS Feed
df - disk space - gives incoorect value


"Unruh" <unruh-spam@physics.ubc.ca> wrote in message
news:XO4zm.47969$PH1.21329@edtnps82...

I'm guessing it was log files in var/log/mysql and var/log/apache2.

Regards
John


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
KDE - Odd Disk-Space Warning J L Strider SUSE Linux Forum 10 09-20-2006 10:41 AM
free disk space... os2 SUSE Linux Forum 1 10-04-2004 03:25 AM
Disk Space Paul Thompson SUSE Linux Forum 1 08-19-2004 03:12 AM
Disk Space ccangia@earthlink.net SUSE Linux Forum 5 04-29-2004 04:39 PM
More disk space raffelm Linux Forum 6 01-12-2004 03:12 AM


All times are GMT. The time now is 04:29 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93