LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-02-2010, 10:34 AM   #1
Hmail
LQ Newbie
 
Registered: May 2007
Posts: 19

Rep: Reputation: 0
df -h returns wrong values


Hi guys,

I'm having a kind of weird issue, and it's not a big problem, but it's kind of annoying. If I run df -h on my server, I get the following values:
Code:
henk@tiffany:~$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/root             9.5G  4.9G  4.2G  55% /
/dev/sda1             917G  898G     0 100% /media/disk1
/dev/sdb1             917G  723G  148G  84% /media/disk2
tmpfs                 122M     0  122M   0% /dev/shm
/dev/hda1             7.9G  6.5G  1.4G  83% /media/windows
As you can see, except from tmpfs and /dev/hda1, the other filesystems have a wrong size. I'm not very good in calculations, 917 minus 898 isn't 0. I tried to run some fsck scans on those partitions, but that doesn't solve anything. I can still write to /dev/sda1, but if I want to copy files through samba to this disk, it refuses it, because the disk is full. I would love to have these 19 Gigabyte available, and I'm also wondering why this is.
As for the filesystem types, /dev/sda1 and /dev/sdb1 are ext3 and /dev/root is ext4.

Can anyone explain me why this is, and, if possible, how I can solve this?
 
Old 03-02-2010, 11:11 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
It has to do with reserved blocks. There is a certain amount reserved so that root and system processes can continue to write to a disk but it will be seen as "full" by non-root processes.

From the mkfs.ext3 man page:

Quote:
-m reserved-blocks-percentage
Specify the percentage of the filesystem blocks reserved for the super-user. This avoids fragmentation, and allows root-owned daemons, such as syslogd(8), to continue to function correctly after non-privileged processes are prevented from writing to the filesystem. The default percentage is 5%.
You're using 97% so presumably the writing you've been doing outside of Samba is as root.
 
1 members found this post helpful.
Old 03-02-2010, 01:14 PM   #3
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
.. and the amount of disk space that is reserved for the root user can be altered with tune2fs

See man tune2fs

If you are referring to an external "media" disk, you can probably set the reserved blocks to zero, but never, ever do this for your root filesystem, or one day you may be unable to login, even as root, to fix the mess.

[ You could recover from the above by using a live CD though, but these did not exist when the ext2 / ext3 filesystems were first engineered, but do you want to run the risk of trashing your system because root has run out of filespace? ].

Last edited by tredegar; 03-02-2010 at 01:16 PM.
 
1 members found this post helpful.
Old 03-02-2010, 02:53 PM   #4
Hmail
LQ Newbie
 
Registered: May 2007
Posts: 19

Original Poster
Rep: Reputation: 0
Great, thanks for the explanation! I'm going to take a look at tune2fs
I'll let the /dev/root partition stay as it is, but these /media partitions (which are seperate hard drives) don't need reserved space to log in on those. I assume it's still possible to mount a full disk, or am I wrong?

edit: For future reference:
tune2fs -r 0 /dev/sda1
tune2fs -r 0 /dev/sdb1

and:
Code:
root@tiffany:~# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/root             9.5G  4.9G  4.2G  55% /
tmpfs                 122M     0  122M   0% /dev/shm
/dev/hda1             7.9G  6.5G  1.4G  83% /media/windows
/dev/sdb1             917G  723G  195G  79% /media/disk2
/dev/sda1             917G  899G   19G  98% /media/disk1
Thanks a lot!

Last edited by Hmail; 03-02-2010 at 03:06 PM.
 
Old 03-02-2010, 03:13 PM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
I assume it's still possible to mount a full disk, or am I wrong?
This is linux. So you are in control. You can mount whatever you like, wherever you like, as you choose.

Some choices might be inadvisable though. For example, running tune2fs not to allow root to have some reserved disk space on your root partition might be a mistake you will regret bitterly in the future. So don't do that, is my advice.

But for your "media" disks, it'll be fine. If you run out of space on one of them, you'll be fine, because although you cannot save that big file, your system will still boot, and you can clean up, delete unnecessary stuff to free up space and fix it.

Best to read up on this so you fully understand what you are doing, and why.

Linux puts you in control, so you had better know why you are changing the defaults (which are generally safe) and the repercussions of making any changes.

Then you'll be both happy and safe.
 
2 members found this post helpful.
Old 03-02-2010, 04:05 PM   #6
Hmail
LQ Newbie
 
Registered: May 2007
Posts: 19

Original Poster
Rep: Reputation: 0
Okay, cool, thanks a lot, I just asked it for verification. I know it's Linux, I pretty much know my way around it, but because I'm in control, I can still mess up. A lot That's why I wanted to be sure.

I left the /dev/root as it was, because of these warnings. However, I'm almost sure that, sooner or later, I'll mess up big time. I might know what I'm doing, but I still want things to be done quickly instead of safe. Luckily it's my own server, and I would be the only one who will cry my eyes out. But unfortunately, that's just the best way to learn it. For now, I've avoided that. Thanks a lot for the warnings!
 
Old 03-02-2010, 04:36 PM   #7
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
I pretty much know my way around it, but because I'm in control, I can still mess up. A lot.
So that's why you take full backups, of course.
Quote:
I might know what I'm doing, but I still want things to be done quickly instead of safe.
"Quick" or "safe" ? Well, "You makes your choice and takes your pick". You can have one, or the other, but not necessarily both.
 
  


Reply

Tags
df, ext3, ext4, slackware



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
top linux command reporting wrong values Vikneels Linux - General 1 05-21-2009 06:47 PM
search in slackbuilds returns wrong item garyg007 Slackware 3 11-02-2008 02:01 PM
UUID: wrong values in Ubuntu /etc/fstab files grautu Ubuntu 7 05-05-2007 04:28 PM
ntpdate's behavior when DNS returns multiple values blackhole54 Ubuntu 6 02-05-2007 05:52 AM
cdrecord returns wrong startsec warning parthenios Linux - Hardware 1 03-05-2005 12:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:49 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