How does FreeBSD calculate disk sizes

andi payn andi_payn at
Mon Nov 3 01:45:55 PST 2003

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

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)

More information about the freebsd-questions mailing list