LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 12-21-2002, 11:33 AM   #1
mark_umr
LQ Newbie
 
Registered: Sep 2002
Posts: 29

Rep: Reputation: 15
df not truly reporting disk free space, why?


I am still trying to figure out a problem that I ran into this past week with gdm, nothing has shown up in the logs...anyway, I'm wondering about disk free space because I get a warning during boot about it.

Just the other day I deleted a directory with 160 MB of files in it. Since then, I expected there to be a decent amount free, but this is only partially reflected in the df run:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hda1 3826552 3620832 11336 100% /

Now, you can see that at least 160 was freed since the other day, because 3826552 - 3620832 = 205720 (which should be around 205 MB). For a ~4 GB partition, this is about 5 percent. However, df is reporting only 11 MB free, and that the partition has 100% in use. Rpmdrake 9.0 (mandrake 9.0 tool) reports 200 free though.

Why is df falsely reporting the amount in use (100%), and the amount available (11336)?
 
Old 12-22-2002, 02:31 AM   #2
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 46
By default, the ext2 filesystem reserves 10% of the disk space on a
partition for root, and df knows to ignore that 10%. I don't know what
Rpmdrake uses, but it looks like that tool doesn't respect the reserve.
You want to reserve SOME space for root so you can save yourself
if you have a problem, but IMHO 10% of a 40G drive is excessive.
Check out the man page for tune2fs.
 
Old 12-22-2002, 04:53 AM   #3
mark_umr
LQ Newbie
 
Registered: Sep 2002
Posts: 29

Original Poster
Rep: Reputation: 15
Why does it reserve anything?!

I have 256 MB of RAM and nearly as large of swap partition...bad Linux!

But, seriously, is there anyway I can prevent this? Surely it does not need 256 MB + ~256 MB + 10% of 4 GB.

Feeling like I'm dealing with Windows and its swap file in the same partition...
 
Old 12-22-2002, 08:31 PM   #4
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
Moses told you how to fix it You should read up on the man page for tune2fs, here's the chunk you'll wanna look for probably:
Quote:
-m reserved-blocks-percentage
Set the percentage of reserved filesystem blocks
Cool
 
Old 12-22-2002, 08:33 PM   #5
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
As for your swap, if you don't want to use that much swap space, and believe it's just "worthless" then you can add that back into your "pool" of HD space. You'll need to resize your partition with something like Parted, but if you feel it's worth it, go for it.

Cool
 
Old 12-22-2002, 09:04 PM   #6
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 46
Actually, the reason it reserves it is because if some user
happened to have write permission on your root partition (say
they could write to /tmp), and they filled your partition with junk
(say music or pr0n), then root would still have a way to log in. If
the root partition didn't have any space reserved for root, then
root couldn't log in and fix the problem. This provides root with
the ability to write important files when your users have "filled" the
disk. Not a bad thing. You really should NOT reduce the
reserved space to nothing, as you can get into trouble, and since
you're already down to 160 M from 4G, I'd say you may need it.
 
Old 12-22-2002, 09:13 PM   #7
mark_umr
LQ Newbie
 
Registered: Sep 2002
Posts: 29

Original Poster
Rep: Reputation: 15
Actually, I'm using ext3. Is tune2fs safe to use on ext3 (it mentions ext3 in various spots in the man page)? Also, based on math, it doesn't seem like 10% is in reserve, maybe 5%. Is there a way to verify that? I do not see any options to show the current settings in the man page.

Thanks for all the info.
 
Old 12-22-2002, 09:17 PM   #8
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
Ext3 is ext2 with -j or journaling. You can (usually) use ext2 tools on ext3. So tune2fs is just fine for you.

As for listing:
tune2fs -l <device>

Here's what my /dev/hda5 reported:
Code:
root@masterc:~# tune2fs -l /dev/hda5 
tune2fs 1.27 (8-Mar-2002)
Filesystem volume name:   <none>
Last mounted on:          <not available>
Filesystem UUID:          5bcb6dca-0f7c-11d7-925c-f24f10abf103
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal filetype needs_recovery sparse_super
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              836992
Block count:              1672760
Reserved block count:     83638
Free blocks:              1017244
Free inodes:              676540
First block:              0
Block size:               4096
Fragment size:            4096
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         16096
Inode blocks per group:   503
Last mount time:          Sun Dec 22 09:23:58 2002
Last write time:          Sun Dec 22 09:23:58 2002
Mount count:              16
Maximum mount count:      -1
Last checked:             Sat Dec 14 07:54:42 2002
Check interval:           0 (<none>)
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               128
Journal UUID:             <none>
Journal inode:            8
Journal device:           0x0000
First orphan inode:       0
root@masterc:~#
You can see this line:
Reserved block count: 83638

That shows the reserve.

Cool
 
Old 12-22-2002, 11:20 PM   #9
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 46
I may have been in error about the 10% reserve as default, it was
some time ago, but could have been changed by the developers
due to disk space becoming so plentiful. 1-3% (40-120 MB) should
be just fine for recovery situations on your partition, and you could
probably even get away with less, though I caution against it.
 
  


Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
No free space on disk, but there is? Recirqie Suse/Novell 4 02-22-2013 01:17 PM
free disk space mp4-10 Linux - Software 1 04-06-2005 03:32 AM
rm doesn't free the disk space krizzz Linux - General 5 02-16-2005 11:27 AM
Free up disk space TheShemeta Slackware 5 11-26-2003 04:50 PM
How to see free disk space bripage Linux - General 3 04-29-2002 08:38 PM


All times are GMT -5. The time now is 08:59 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration