LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-14-2012, 01:41 PM   #1
BiFo
LQ Newbie
 
Registered: Aug 2010
Posts: 11

Rep: Reputation: 0
df command percentage error


Hi.
Code:
root@ServerHostname:/# df -h
Filesystem                      Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-Backups  425G  377G   27G  94% /Backups
Look carefully the result of my "df" command...
Size = 425G
Used = 377G
Available = 27G
Used + Available = 404G != 425G

¿Why is Used + Available different from Total Size? This is not happening in any other server.
I've tried remounting and rebooting the system.
The "du" command show that the "Used" space in the "/Backups" directory from the "df" command is correct!


Details:
* Slackware 13.37.0
* Linux 2.6.37.6-smp #1 SMP Sat Apr 9 14:01:14 CDT 2011 i686 Intel(R) Xeon(R) CPU E5530 @ 2.40GHz GenuineIntel GNU/Linux
* HP DL360 G6

Thanks in advance.
Bye!
 
Old 05-14-2012, 03:40 PM   #2
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
This happens frequently with the way df reads disk usage statistics by using file descriptors. Follow this example to see what I'm talking about.

You have a 10GB partition for /var/.

You have an application that spawns a process that logs data to /var/app/log which is always running and will rotate/remove old log files as needed.

Your process has created several log files of 1GB each /var/app/log.1 /var/app/log.2 that totals to 9GB. Your process sees this and removes 5 old log files to bring you down to 4GB of total disk space consumption.

You run du on /var/ and it comes back with 4GB.

You run df -h and /var/ shows using 9GB still.

You kill your logging process which allows df to read the new file descriptors since the process is no longer using them and reports the statistics correctly.


Excerpt from link below


df will include open files (in memory, but not on disk), data/index files (used for data management - sometimes using approximately 2 to 5% of each filesystem) and unnamed files in its size calculation. This is one reason why, sometimes (although not very often), df can show a larger amount of disk used than du does.


Check out http://linuxshellaccount.blogspot.co...nt-values.html

at the end of the day trust du and not df if you have to choose which one is more correct.
 
Old 05-14-2012, 04:25 PM   #3
neillohit
LQ Newbie
 
Registered: May 2012
Posts: 6

Rep: Reputation: Disabled
Kustom42 covered most of it, but other thing to consider is the reserved blocks for journaling for any journaling based file system like ext3 or ext4.
You can change that by tune2fs -m 1 <filesystem name>
The above command will change journaling blocks to 1% and you would see more available in df -h. Specially in larger file syatems, you might not need the default 5%.
 
1 members found this post helpful.
Old 05-20-2012, 09:39 AM   #4
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
Quote:
Originally Posted by neillohit View Post
Kustom42 covered most of it, but other thing to consider is the reserved blocks for journaling for any journaling based file system like ext3 or ext4.
You can change that by tune2fs -m 1 <filesystem name>
The above command will change journaling blocks to 1% and you would see more available in df -h. Specially in larger file syatems, you might not need the default 5%.
While I agree to use -m to lower the amount of reserved blocks (as it fits perfect to the missing 23G), this has nothing to do with journaling. These are reserved blocks for privileged processes running under the root account. For some filesystems like /home it can even be set to 0.
 
Old 05-21-2012, 02:36 PM   #5
neillohit
LQ Newbie
 
Registered: May 2012
Posts: 6

Rep: Reputation: Disabled
Thanks Reuti for the correction.
 
  


Reply



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
bash cut command to get df percentage nutthick Programming 8 12-16-2010 11:02 AM
LQ reputation as a percentage Berhanie LQ Suggestions & Feedback 28 09-07-2010 03:03 PM
gprof percentage numbers mllouay Linux - General 0 08-28-2008 10:37 AM
Percentage of all Code Written in C jhwilliams Programming 1 09-09-2007 11:11 PM
What is the percentage of each distro in use ? newlin Linux - General 1 08-03-2003 04:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:13 AM.

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