LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 04-22-2007, 12:17 PM   #16
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 70

Quote:
Originally Posted by bskrakes
WAIT..... that isn't right. the only reason why the space is different is because i had less files on there than before.... check the used space....
I think this is mostly true, but it doesn’t “add up” altogether:

Original Used Space: 82G
New Used Space: 66G
Size of Files Cleared: 16G (82-66)

Original Avail. Space: 347G
New Avail. Space: 387G
Size of Space Freed: 20G (387-347)

Amount of Space Freed Because of Elimination of Reserved Space: 4G (20-16)

So it seems the space you got “for free” isn’t all that huge.
 
Old 04-22-2007, 02:00 PM   #17
bskrakes
Member
 
Registered: Sep 2006
Location: Canada, Alberta
Distribution: RHEL 4 and up, CentOS 5.x, Fedora Core 5 and up, Ubuntu 8 and up
Posts: 251

Original Poster
Rep: Reputation: 32
Ok yes you are right. At first glance I see where I made the mistake. It still adds up to 452 to though.... I will have to take a good look at this because I keep going back and forth.
 
Old 04-24-2007, 11:12 AM   #18
bskrakes
Member
 
Registered: Sep 2006
Location: Canada, Alberta
Distribution: RHEL 4 and up, CentOS 5.x, Fedora Core 5 and up, Ubuntu 8 and up
Posts: 251

Original Poster
Rep: Reputation: 32
Ok so osor.... if you take the current system specs verse the old ones....

NEW:
[brendan@sdm ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol02
48G 3.4G 42G 8% /
/dev/sda1 244M 17M 215M 8% /boot
tmpfs 501M 0 501M 0% /dev/shm
/dev/mapper/VolGroup00-LogVol03
94G 2.5G 87G 3% /home
/dev/mapper/VolGroup01-LogVol00
452G 83G 370G 19% /media

/dev/mapper/VolGroup00-LogVol01
961M 23M 890M 3% /tmp


Now if you add 370G (available space) and 83G (used space) you get 453G.... so I am failing to see where we gained the space. Maybe df -h doesn't show it?

To help more I have run this test as well:

du -s -k /media/samba | sort -k1nr | less
85887220 /media/samba/

Err I don't know.
 
Old 04-24-2007, 04:17 PM   #19
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 70
Quote:
Originally Posted by bskrakes
Now if you add 370G (available space) and 83G (used space) you get 453G.... so I am failing to see where we gained the space. Maybe df -h doesn't show it?
I am failing to see the problem, but I’ll ramble on anyway . Is your question that 453 != 452? If so, that is just rounding error. Try the same calculation using output from “df” instead of “df -h” (where it gives you block count).

In terms of gained space, it will be visible in the “Avail” field. Looking the source of df and the manpage for statvfs, we see the following:
  • The second field in df’s output is the number of data blocks on the filesystem (corresponding to the f_blocks of struct statvfs). This count includes both the reserved and non-reserved blocks
  • The fourth field in df’s output is the number of available blocks (corresponding to f_bavail). This is the number of free blocks for non-privileged processes.
  • The df utility does not report any count corresponding to f_bfree (the number of free blocks, reserved and otherwise). It does, however, use this member (which it calls “uintmax_t available_to_root”) when calculating the third and fifth fields.
So the “unreserving” of previously reserved blocks will not show up in the second field of df (since the total number of blocks never changed). It will (and did) show up in the fourth field.

P.S.
I don’t see what you are trying to do with that du command.
 
Old 04-24-2007, 05:07 PM   #20
bskrakes
Member
 
Registered: Sep 2006
Location: Canada, Alberta
Distribution: RHEL 4 and up, CentOS 5.x, Fedora Core 5 and up, Ubuntu 8 and up
Posts: 251

Original Poster
Rep: Reputation: 32
It is quite ok, ramble all you want. Talking a problem through with an individual who knows what there talking about is totally worth it! I guess as long as the POINT is there and not a bunch of gibberish.

Alright just using the df (I should have thought of that, just showing block size) works:

[brendan@sdm ~]$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol02
49580256 3544104 43476972 8% /
/dev/sda1 248895 16671 219374 8% /boot
tmpfs 512220 0 512220 0% /dev/shm
/dev/mapper/VolGroup00-LogVol03
98555352 2608300 90859820 3% /home
/dev/mapper/VolGroup01-LogVol00
473047768 86090024 386957744 19% /media

/dev/mapper/VolGroup00-LogVol01
983960 22812 910360 3% /tmp



So the block size is right. BUT why would df -h show different results? We cleared the reserved blocks so shouldn't is show that? I am going to try that statvfs, I do know the df stuff but just didn't think about checking the basic block size, trying to think about this one to hard I think.

Thanks again osor. Have a great night.
 
Old 04-24-2007, 07:39 PM   #21
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 70
Quote:
Originally Posted by bskrakes
BUT why would df -h show different results?
It’s rounding error, depending on whether you add or round first. Here’s what happens when you round after adding:

086090024 × 2^(-20) = 082.102 (083G)
386957744 × 2^(-20) = 369.032 (370G)
473047768 × 2^(-20) = 451.134 (452G)

If I round up and then add them, I get 83 + 370 = 453 != 452.

Admittedly, it might help if df had saner rounding (rather than just rounding up).
 
Old 04-24-2007, 10:37 PM   #22
bskrakes
Member
 
Registered: Sep 2006
Location: Canada, Alberta
Distribution: RHEL 4 and up, CentOS 5.x, Fedora Core 5 and up, Ubuntu 8 and up
Posts: 251

Original Poster
Rep: Reputation: 32
I didn't mean different results with 452/453. I meant with the block size. If the block size has changed shouldn't it show 465 instead of 453?

Cheers and sorry for the confusion!
 
Old 04-25-2007, 11:00 AM   #23
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 70
I’m still confused… what does block size have to do with anything? Your “true” block size (as reported by dumpe2fs and statvfs() — the size of each filesystem block) is 4kB. The size of the unit given by df to show how much space you have is 1kB. But the block size never changed. If you look at the output of dumpe2fs, you’ll still see the block size says 4096 bytes (i.e., 4kB) and the header in the output of df says “1K-blocks”. So plain “df” displays a count of how many kilobytes each filesystem has in various ways (total, used, available, etc.). When you use “df -h”, it displays the same information, but just converts it to a human-readable form — namely gigabytes.

How do you expect to get 465G from 452G anyway? As I said before, any space that was gained in unreserving will not show up in the total, but only in the available. We saw that the space gained was approximately 4G (not much), and it showed up in the available section of df.
 
Old 03-22-2008, 12:07 PM   #24
jpmckinney
LQ Newbie
 
Registered: Mar 2008
Posts: 2

Rep: Reputation: 0
This what changed:

Original: 82 used + 347 avail = 429 GiB (23 short of the size of 452 GiB)
Newer: 66 used + 387 avail = 452 GiB (exactly the size of 452 GiB)

In the original, 23 GiB was reserved. Now it's not. You gained 23 GiB. You can't increase the size of your disk past 452 GiB.

Most hard drives are advertised as GB not GiB, but Linux lists filesystem sizes in terms of GiB:

One GB = 1000 MB = 1,000,000,000 bytes.
One GiB = 1024 MB (1000 MiB) = 1,073,741,824 bytes.

500 GB in GiB = 465 GiB, which is what Linux should report as the size of your 500 GB drive. Why it reports 452 GiB, I don't know. My 500 GB drive is reported as 459 GiB.

hxxp://en.wikipedia.org/wiki/Gibibyte

----

Original “df -h”
Code:
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      142G  3.4G  132G   3% /
/dev/sda1              99M   17M   78M  18% /boot
tmpfs                 501M     0  501M   0% /dev/shm
/dev/mapper/VolGroup01-LogVol00
                      452G   82G  347G  20% /home
/dev/sda5             487M   13M  449M   3% /tmp
Newer “df -h”
Code:
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol02
                       48G  3.4G   42G   8% /
/dev/sda1             244M   17M  215M   8% /boot
tmpfs                 501M     0  501M   0% /dev/shm
/dev/mapper/VolGroup00-LogVol03
                       94G  2.5G   87G   3% /home
/dev/mapper/VolGroup01-LogVol00
                      452G   66G  387G  15% /media
/dev/mapper/VolGroup00-LogVol01
                      961M   23M  889M   3% /tmp
 
Old 03-24-2008, 04:18 PM   #25
bskrakes
Member
 
Registered: Sep 2006
Location: Canada, Alberta
Distribution: RHEL 4 and up, CentOS 5.x, Fedora Core 5 and up, Ubuntu 8 and up
Posts: 251

Original Poster
Rep: Reputation: 32
I haven't looked into this for a while! As for your comment jpmckinney that all makes sense but what I don't get is why Linux doesn't display the drive as 465 GB?????? As you said yours shows up with 459GB. Could it be the Linux file system? I notticed if I go through the GUI it shows 465 - I am going to recheck that tonight though. In Windows a 500GB drive shows up as 465GB which is what you would expect in Linux to. Maybe I have some bad sectors?!?!?!?!

Thanks for your reply!
 
Old 03-24-2008, 11:45 PM   #26
jpmckinney
LQ Newbie
 
Registered: Mar 2008
Posts: 2

Rep: Reputation: 0
Maybe in Linux, it reports the size of the drive minus the filesystem overhead and journal overhead; and in Windows (and Mac OS X), it just reports the size of the drive. That's my guess.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sata Raid 1 and Single Sata drive drive order issue Kvetch Linux - Hardware 5 03-19-2007 06:50 PM
Logical Volume and New Hard Drive Hambone_20003 Linux - Hardware 2 02-16-2007 08:27 PM
320GB hard drive shows up as 150GB bluelightning Linux - Hardware 4 07-03-2006 06:26 AM
how to install a usb 2.0 hard drive (500 GB) on red hat WS3 U4 cmolina Linux - Hardware 2 08-08-2005 02:04 PM
Does Anyone Know About The Hard Drive Volume Group harley51 Fedora 1 11-21-2004 07:13 PM


All times are GMT -5. The time now is 03:11 PM.

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