LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-14-2005, 02:30 PM   #1
jadukor
Member
 
Registered: Nov 2005
Location: Bangladesh
Distribution: openSUSE
Posts: 83

Rep: Reputation: 15
Different commands, different results


Hi all

I am newbie running Slackware-10.2

A quick question
Can any one please tell me why the two commands are giving results??

******************
bash-3.00$ df -h /boot
Filesystem Size Used Avail Use% Mounted on
/dev/hda6 48M 37M 11M 78% /boot
bash-3.00$ du -hs /boot
4.2M /boot
bash-3.00$
******************

Thanks
 
Old 12-14-2005, 02:47 PM   #2
rbochan
Member
 
Registered: Dec 2004
Location: Central New York
Distribution: Debian
Posts: 218

Rep: Reputation: 30
The du command only outputs the usage of the files that exist there. The df output includes space 'reserved' for the journaling filesystem (ext3, reiserfs, etc.).
 
Old 12-14-2005, 03:14 PM   #3
jadukor
Member
 
Registered: Nov 2005
Location: Bangladesh
Distribution: openSUSE
Posts: 83

Original Poster
Rep: Reputation: 15
Thank man

I had no idea that journaling filesystem or any filesystem required space, but compared to the size of the partition, it is a lot of space don't you think, I mean practically more than half the partion space is gone!! Is it OK????

Thank
 
Old 12-14-2005, 03:22 PM   #4
mdarby
Member
 
Registered: Nov 2004
Location: Columbus, Ohio
Distribution: Slackware-Current / Debian
Posts: 795

Rep: Reputation: 30
It's allocated space only. You still have 43.8M left on /boot
 
Old 12-14-2005, 03:48 PM   #5
jadukor
Member
 
Registered: Nov 2005
Location: Bangladesh
Distribution: openSUSE
Posts: 83

Original Poster
Rep: Reputation: 15
Isee...hummmm :-)

Thanks a lot guys
 
Old 12-14-2005, 04:02 PM   #6
jadukor
Member
 
Registered: Nov 2005
Location: Bangladesh
Distribution: openSUSE
Posts: 83

Original Poster
Rep: Reputation: 15
one more thing guys

how do you explain this, du command is showing more space usage than the df command

bash-3.00$ df -h /opt
Filesystem Size Used Avail Use% Mounted on
/dev/hda8 1.2G 676M 470M 60% /opt
bash-3.00$ du -hs /opt
698M /opt
bash-3.00$
 
Old 12-15-2005, 01:26 PM   #7
jadukor
Member
 
Registered: Nov 2005
Location: Bangladesh
Distribution: openSUSE
Posts: 83

Original Poster
Rep: Reputation: 15
OK I have reformatted and reinstalled Slackware to flush out any problem but it is still the same

bash-3.00$ df -h /boot
Filesystem Size Used Avail Use% Mounted on
/dev/hda6 48M 37M 11M 78% /boot
bash-3.00$ du -hs /boot
4.2M /boot
bash-3.00$ df -h /opt
Filesystem Size Used Avail Use% Mounted on
/dev/hda8 1.2G 676M 470M 60% /opt
bash-3.00$ du -hs /opt
698M /opt
bash-3.00$


Can someone please please tell me what is goingon....PLEASE

Thanks
 
Old 12-15-2005, 10:43 PM   #8
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
It could be that a process has deleted a file but not closed all of the file descriptors pointing to it. This is unlikely in your case since you've formatted the disk and still have the problem, but try running `lsof +aL1 /boot` and see if anything turns up.

There are a couple of links I tried to post about open files, but I don't have 5 previous posts under my belt...
 
Old 12-16-2005, 03:15 PM   #9
jadukor
Member
 
Registered: Nov 2005
Location: Bangladesh
Distribution: openSUSE
Posts: 83

Original Poster
Rep: Reputation: 15
Thanks everyone for your time

I have found the solution from another group & I am describing it below, it is going to be a bit long, so if you are not interested you can skip it now.

Thanks

For my first case

******************
bash-3.00$ df -h /boot
Filesystem Size Used Avail Use% Mounted on
/dev/hda6 48M 37M 11M 78% /boot
bash-3.00$ du -hs /boot
4.2M /boot
bash-3.00$
******************

The solution provider suggested this

************
I'm guessing you're using ReiserFS with the default 32MB journal.
************

and was he was right, it was ReiserFS, and you will notice that the difference between the df & du result is approximately 32MB. Makes sense... so I tried it for all my partitions

*******************
bash-3.00# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda5 283M 104M 179M 37% /
/dev/hda6 48M 37M 11M 78% /boot
/dev/hda7 283M 47M 237M 17% /home
/dev/hda8 1.2G 676M 470M 60% /opt
/dev/hda9 283M 33M 250M 12% /root
/dev/hda10 283M 33M 251M 12% /tmp
/dev/hda11 2.4G 1.6G 810M 67% /usr
/dev/hda12 957M 50M 907M 6% /var
bash-3.00# du -hs /boot /home /opt /root /tmp /usr /var
4.2M /boot
16M /home
698M /opt
1.2M /root
49K /tmp
1.7G /usr
19M /var
bash-3.00#
******************

You will notice that all the results have an approximate difference of 32MB with the exception of /opt & /usr (the 2 most largest partitions). This is where the solution to my second problem comes in

For my second case

***********************
bash-3.00$ df -h /boot
Filesystem Size Used Avail Use% Mounted on
/dev/hda6 48M 37M 11M 78% /boot
bash-3.00$ du -hs /boot
4.2M /boot
bash-3.00$ df -h /opt
Filesystem Size Used Avail Use% Mounted on
/dev/hda8 1.2G 676M 470M 60% /opt
bash-3.00$ du -hs /opt
698M /opt
bash-3.00$
**********************
The solution provider suggested this

*****************
ReiserFS does tail packing, which means that it can use one disk block
for storing the last, incomplete blocks of two different files if they
both fit.

du doesn't know anything about tail packing and works on the basis of
how many blocks each file spans.

With ReiserFS you may find du is more accurate if you get it to ignore
block sizes, eg:
du -bhs /opt
*****************
and sure enough this time all the du results were smaller than df results

******************
bash-3.00# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda5 283M 104M 179M 37% /
/dev/hda6 48M 37M 11M 78% /boot
/dev/hda7 283M 47M 236M 17% /home
/dev/hda8 1.2G 676M 470M 60% /opt
/dev/hda9 283M 33M 250M 12% /root
/dev/hda10 283M 33M 251M 12% /tmp
/dev/hda11 2.4G 1.6G 810M 67% /usr
/dev/hda12 957M 50M 907M 6% /var
bash-3.00# du -bhs /boot /home /opt /root /tmp /usr /var
4.2M /boot
14M /home
617M /opt
281K /root
6.8K /tmp
1.5G /usr
18M /var
bash-3.00#
****************

Any comments or suggestion will be welcomed
 
  


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 - execute commands on a remote machine capture results, etc dkrysak Programming 1 11-18-2005 01:50 PM
explain results of a df to me mgm36 Linux - Newbie 2 04-28-2005 03:16 PM
Same C code different results Veteq Programming 17 07-24-2004 03:26 AM
Bonnie++ results jpc82 Linux - Software 0 04-17-2004 06:39 AM
Executing commands and getting command results. xconspirisist Programming 2 03-11-2004 02:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:00 PM.

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