Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 03-28-2008, 04:32 AM   #1
LQ Newbie
Registered: Mar 2008
Posts: 2

Rep: Reputation: 0
The data from the command "df" is not updated


I've got a server which has a cron that alerts me when the used space is above 80%. To do this the cron uses the "df" command.

Some days ago it alerts me, because it was used the 82% of the disk. Then I go to the server and I delete a log (11G) that was the cause of this. But the next day it alert me again, and the next again,...

So I go to the server and when I wrote "df", I saw that df was giving wrong data.

Someone says me to reboot the machine, and after doing it "df" works fine and the server stopped alerting me.

┐How often updates "df" its data? ┐Must I reboot the machine always to update it?

Thanks and greetings!!
Old 03-28-2008, 05:04 AM   #2
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
No. I think it's not a problem of df. Being a log file most likely it was still in use from some application when you deleted it. Since the application points to the file through its inode number, even if you delete the entry in the directory list, that block of data is still there and it will be counted in the disk space usage until the application uses it.

Therefore a reboot its not necessary. You can simply restart the application which used the file, most likely the syslogd service.
Old 03-28-2008, 05:23 AM   #3
LQ Newbie
Registered: Mar 2008
Posts: 2

Original Poster
Rep: Reputation: 0

I restart the application and it works!
Old 03-28-2008, 08:47 AM   #4
Registered: Apr 2005
Location: UK
Distribution: Slackware 13.0
Posts: 241

Rep: Reputation: 34
Additionally, if you have 11Gb logfiles, you should really be rotating them properly or they will just become unmanageable like this.

Setting up log rotation so that, for example, you get nine individual 1Gb logfiles that cycle each day would mean that once your server's been running for ten days, it's disk requirements will stay pretty much the same all the time. And removing log files from underneath a program can cause problems (although it would have to be a particularly poorly-written program, I have to admit).

What if that program had gone mad and written hundreds of gigs instead of a few? The machine would have come to a halt and nobody would have been able to use it until you cleared it. Also, if the program that generated them was running as root, there's the possibility that you wouldn't have been ABLE to log in, even as root or in single-user-mode, to fix it because it would have written every byte it could onto the disk and filled it up completely, including the default 5% root-only emergency space.

And the next question is, how often do you (or anyone else) ever look at those logs? What's the point of spooling off logs to the disk if they get to 11Gb and then just get deleted? Either turn off logging, tone it down a bit or put in some form of log rotation/management.


commands, df, disk, space

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
Shell Script: Find "Word" Run "Command" granatica Linux - Software 5 07-25-2007 07:42 AM
Make "ls" command show colors without "--color=always" switch SharpyWarpy Linux - General 4 07-16-2007 11:00 PM
"list dynamic dependency" of an executable using command other than "ldd" Amrita@3086 Solaris / OpenSolaris 3 04-04-2007 04:56 AM
Tiny Sofa 2.0 - I thought "halt", "reboot" were only root command ?? sorcerer Linux - Distributions 1 08-21-2004 03:28 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:49 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration