How does FreeBSD calculate disk sizes

2003-11-03 Thread Odhiambo Washington

Hello users,

I have a disk which is actually 72GB. 2GB has been used as swap while
the rest was given to /.

Can someone explain to me what I could be missing here, because what
I am seeing isn't what I expect. Perhaps it's just right while I am
the dumb one. Why isn't the whole size reported?


sucks# uname -nmr
sucks.wananchi.com 5.1-RELEASE-p10 i386

sucks# df -h
FilesystemSize   Used  Avail Capacity  Mounted on
/dev/da0s1a64G   1.8G57G 3%/
devfs 1.0K   1.0K 0B   100%/dev


Here is what the partition editor shows:


Disk name:  da0FDISK Partition Editor
DISK Geometry:  8855 cyls/255 heads/63 sectors = 142255575 sectors (69460MB)

Offset   Size(ST)End Name  PType   Desc  SubtypeFlags

 0 63 62- 12 unused0
63  142255512  142255574da0s1  8freebsd  165
 142255575   8425  142263999- 12 unused0 



And disklabel shows this:



sucks# disklabel -n da0s1a
# /dev/da0s1a:
8 partitions:
#size   offsetfstype   [fsize bsize bps/cpg]
  a: 138255512   634.2BSD 2048 16384 28552 
  b:  400 138255575  swap
  c: 142255512   63unused0 0 # raw part, don't edit
partition a: partition extends past end of unit
partition b: offset past end of unit
partition b: partition extends past end of unit
partition c: partition extends past end of unit
disklabel: partition c doesn't start at 0!
disklabel: partition c doesn't cover the whole unit!
disklabel: An incorrect partition c may cause problems for standard system utilities


Some expert explanation would help clear my ignorance!

Thank you.

-Wash

http://www.netmeister.org/news/learn2quote.html

--
|\  _,,,---,,_ | Odhiambo Washington[EMAIL PROTECTED]
Zzz /,`.-'`'-.  ;-;;,_ | Wananchi Online Ltd.   www.wananchi.com
   |,4-  ) )-,_. ,\ (  `'-'| Tel: +254 20 313985-9  +254 20 313922
  '---''(_/--'  `-'\_) | GSM: +254 722 743223   +254 733 744121
+
World War Three can be averted by adherence to a strictly enforced
dress code!
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How does FreeBSD calculate disk sizes

2003-11-03 Thread andi payn
I think this is (mostly) a GiB vs. GB confusion.

In case you have no idea what I'm talking about, here's some background
(if you do, skip the next paragraph):

Giga is the metric prefix meaning billion (or thousand million, if
you're British)--that is, 10^9. Computer people tend to use it to mean
2^30, which is actually 1.073741824 * 10^9. However, hard disk
manufacturers use the metric meaning. So, a hard disk maker's GB is 7%
bigger than the rest of the computer industry's GB. To clear up the
confusion, the standards people decided that from now on you're supposed
to use GiB to mean 2^30 (and MiB for 2^20, KiB for 2^10,
etc.--pronounced gibibyte, mibibyte, kibibyte, etc.). And so far,
just about nobody has listened

So, when fdisk says 69460MB, it means 69460 * 2^20, which is
72,834,088,960 bytes. When your disk manufacturer says 72GB, they mean
72,000,000,000 bytes. (They've given you 834MB for free. How nice.)

Meanwhile, when df says your partition is 64GB, it means 64 * 2^30. And
your 2GB swap is, similarly, 2 * 2^30. Do the math:

64 * 2^30 = 68,719,476,736
 2 * 2^30 =  2,147,483,648
--
70,866,960,384

In other words, you're not missing 6GB.

As for the rest of it:

 sucks# disklabel -n da0s1a

da0s1a is a partition, not a slice. You're asking it for the partitions
within a partition; it's bound to get confused. Try this:

# disklabel -n da0s1

(without the a)


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How does FreeBSD calculate disk sizes

2003-11-03 Thread Alexander Marx
Odhiambo Washington wrote:
Hello users,

I have a disk which is actually 72GB. 2GB has been used as swap while
the rest was given to /.
Can someone explain to me what I could be missing here, because what
I am seeing isn't what I expect. Perhaps it's just right while I am
the dumb one. Why isn't the whole size reported?
[...]

first of all, a 72GB harddisk isn't actually a 72GB harddisk; this might
sound funny, but harddisk manufacturers are engineering people and they
are usually thinking in terms of 1000s
(see http://www.seagate.com/support/kb/disc/bytes.html)
so your disk actually only holds 720 bytes (~69GB) ...
which is perfectly consistent with your fdisk output.
further, reading tunefs(8) you will find, that per default your filesystem
reserves some space (8%) for root ...
: -m minfree
: Specify the percentage of space held back from normal users; the
: minimum free space threshold.  The default value used is 8%.
.. subtracting 8% from the remaining 69GB roughly gives 64GB.

so your disk is just fine.

regards,
alex.
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How does FreeBSD calculate disk sizes

2003-11-03 Thread Elessar
Hi

On Mon, 3 Nov 2003 12:07:15 +0300
Odhiambo Washington [EMAIL PROTECTED] wrote:

 Hello users,
 
 I have a disk which is actually 72GB. 2GB has been used as swap while
 the rest was given to /.

Well, 72GByte in the manufacturer's notation which is decimal.
So your disk has 72 * 10^3^3 (= 72'000'000'000) Bytes.
freeBSD works - like every other OS i know - not decimal but dual.
Therefor the disk has 67.055225 * 2^10^3 (= 72'000'000'000) Bytes.

 sucks# uname -nmr
 sucks.wananchi.com 5.1-RELEASE-p10 i386
 
 sucks# df -h
 FilesystemSize   Used  Avail Capacity  Mounted on
 /dev/da0s1a64G   1.8G57G 3%/
 devfs 1.0K   1.0K 0B   100%/dev

Here we have our 67GiByte disk without the 2GiByte Swap, and a little
bit of unused space due to Sector 63 thingies.
So da0s1a ends up having 64GiByte of which iirc 8-10% are reserved and
used for filesystem optimizations. Makes 57GiByte available with 3% (or
1.8Gi) being used.

So everything is there, it's just a little math. And yes, it's quite
a pain in the ass, but you will get used to it ;]

Joerg


pgp0.pgp
Description: PGP signature


Re: How does FreeBSD calculate disk sizes

2003-11-03 Thread Alex de Kruijff
On Mon, Nov 03, 2003 at 12:07:15PM +0300, Odhiambo Washington wrote:
 
 Hello users,
 
 I have a disk which is actually 72GB. 2GB has been used as swap while
 the rest was given to /.
 
 Can someone explain to me what I could be missing here, because what
 I am seeing isn't what I expect. Perhaps it's just right while I am
 the dumb one. Why isn't the whole size reported?
 
 
 sucks# uname -nmr
 sucks.wananchi.com 5.1-RELEASE-p10 i386
 
 sucks# df -h
 FilesystemSize   Used  Avail Capacity  Mounted on
 /dev/da0s1a64G   1.8G57G 3%/
 devfs 1.0K   1.0K 0B   100%/dev
 
 Some expert explanation would help clear my ignorance!

The answers can be found in the FAQ. The source is:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/disks.html#DISK-MORE-THAN-FULL

9.25. How is it possible for a partition to be more than 100% full?

A portion of each UFS partition (8%, by default) is reserved for use by
the operating system and the root user. df(1) does not count that space
when calculating the Capacity column, so it can exceed 100%. Also,
you'll notice that the Blocks column is always greater than the sum of
the Used and Avail columns, usually by a factor of 8%.

For more details, look up the -m option in tunefs(8).

-- 
Alex

Articles based on solutions that I use:
http://www.kruijff.org/alex/index.php?dir=docs/FreeBSD/
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]