It’s been a while since I’ve posted an installment in my Little Things Doth Crabby Make series. While I’m not feeling particularly crabby, I have to admit that this one just got under my skin today.
Giga, Gibi, Giggly
I’m like most of you when it comes to computer capacity nomenclature. In spite of standards bodies I just can’t bring myself to think of a gigabyte as 10^9 bytes. The guys that sell memory still sell 2^30 bytes and processor caches are still sized in multiples of 2^20 bytes (a.k.a. old school Megabytes). But, according to standards bodies a gigabyte is 1000000000 bytes and what I refer to as a gigabyte is actually a gibibyte or 1073741824 bytes.
Network technology has always used the decimal nomenclature (e.g., megabit, gigabit) and since about the late 1990s hard drive manufactures switched to decimal. So, usually when we install something like a 600GB (gigabyte) drive and partition it we see 558 gibibytes such as this drive in the Sun Oracle Exadata Storage Server:
# cat /proc/partitions | grep sdh 8 112 585531392 sdh # bc -l bc 1.06 Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. (585531392 * 1024) / (2^30) 558.40625000000000000000
Help Me Please, He’s Boring Me To Death!
I know, and I apologize. But let me just take one more moment of your time to show you what little thing hath crabby made. It’s all about the content in the following box. I tell dd(1) to write to disk exactly 1GB (a.k.a. “Kevin gigabyte”). That is, I want dd(1) to use a single call to LibC write to fill out 2^30 bytes. That works you know as long as you have address space and physical memory. Anyway, back to the topic. So, I set dd(1) out to create a 2^30 bytes, er, I mean 1GB file and so it did. But, it reported its success to me as if it was a real strict IEEE or networking sort of guy. In the box you’ll see that it reported it wrote 1.1GB and it did—1.1 gigabytes.
Sorry, I’m still boring you to death.
So the thing that made me crabby was the fact that I followed up the dd(1) command with an ls(1) command using the Linux –h option which, according to the manpage, reports sizes to me in “human readable” form. That’s OK with me since to me K,M,G are all powers of two and I’m a human. But I thought we were supposed to start rethinking our way to the decimal nomenclature. Hmmm. See for yourself:
# dd if=/dev/zero of=GB bs=1073741824 count=1 1+0 records in 1+0 records out 1073741824 bytes (1.1 GB) copied, 2.4089 seconds, 446 MB/s # ls -lh GB -rw-r--r-- 1 root root 1.0G Jan 6 14:48 GB
Nah, that didn’t really make me that crabby. I do get tired of the decimal thing though. But worse than that is the schizophrenia dd(1) exhibits. The following is what really made me crabby:
$ dd if=/dev/zero of=1G bs=1G count=1 1+0 records in 1+0 records out 1073741824 bytes (1.1 GB) copied, 1.19684 seconds, 897 MB/s
Now that is a good one! It’s sadly schizophrenic but entertaining.
It despises me when dealing with various storage devices that a vendor’s management application will use different forms of 1GB depending on location. Or, asking for 4GB of ram in VMware actually gives you 3.7GB.
Not boring me. I vaguely remember asking if you’d clarify some of this stuff for people 😉
Indeed…you did… is it clear now, or clearly schizo ? 🙂
Well, Gibibyte was a completely new one for me!
Well, in G actually means Gibibyte in dd and GB means Gigabyte.
Maybe it’s all just BS or did they change that too? 🙂
You need to switch to a more refined Operating System 🙂 Guess the OS below and I will buy you a beer….
$ dd if=/dev/zero of=GB bs=1073741824 count=1
1+0 records in
1+0 records out
$ ls -lh GB
-rw-r–r– 1 oracle dba 1.0G Jan 3 05:56 GB
Glenn,
What does it do if you say bs=1G
The “G” in “bs=1G” is not recognized Giga, Gigi, or anything for that matter.
dd if=/dev/zero of=1g bs=1G count=1
dd: bad numeric argument: “1G”
ah…so Linux is nice enough to offer the short-hand. To bad, as my post points out, it accepts 1G (1024^3 gibi) as shorthand for the amount of work to do, but it uses giga (IEEE, etc) to report what it did as if has a night job as a network protocol…ugh. Little things….indeed…
Glenn, what was the OS that is more refined?
No guesses? Hint: Oracle now owns the OS.