1

This question already has an answer here:

I added via vSphere 5.5 a new Hard Disk of 500MB to a virtual machine and the server sees it as 524MB.

Any idea why?

fdisk -l
>Disk /dev/sdg: 524 MB, 524288000 bytes
>64 heads, 32 sectors/track, 500 cylinders
>Units = cylinders of 2048 * 512 = 1048576 bytes
>Sector size (logical/physical): 512 bytes / 512 bytes
>I/O size (minimum/optimal): 512 bytes / 512 bytes
>Disk identifier: 0x00000000

marked as duplicate by bwDraco, DavidPostill, Scott, JakeGould, BlueBerry - Vignesh4303 Sep 7 '15 at 12:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 5
    because VMWare is creating the disk in MebiBytes, not MegaBytes, as your storage is actually used in Mebibyte increments. 500 * 1048576 = 524288000 => 524MB => 500MiB. MB is misused by disk manufactureres to make their offerings seem larger than they actually are, so for 1TB of storage, you only get 931GiB usable storage. In your case, if you were actually using MB, you would have 500 * 1000000 = 500MB => 476 MiB of actual usuable storage. – Frank Thomas Sep 2 '15 at 14:26
  • At FrankThomas This is the obvious answer. Why not post it as such. @OP: I changed the markup of you post. Indenting with 4 spaces formats the output. If you do not like it you can revert it via the edit link. – Hennes Sep 3 '15 at 10:18
  • @Frank Thomas Agreed - Frank, you should post that as an answer. I'll upvote it. – Jamie Hanrahan Sep 3 '15 at 10:19
5

the Metric prefix Mega- has a couple different implications in different areas of IT, and with Disks it's particularly confusing. Traditionally, Metric Prefixes are powers of 10, but early in IT history, prefixes like kilo, Mega, and Giga were used to present approximated values in powers of 2, when converted to decimal.

Disk manufacturers take the prefix literally and measure a KB as 1000 (10^3) bytes, whereas in actual use, a kilobyte's size must be a power of 2 (since its composed of Bits), and is commonly accepted to be 1024 Bytes (2^10). A MB to Disk Manufacturers is 1000000 Bytes, whereas to everyone else, it is 1048576 (2^20), including your OS, so when you store a 1KB file, it takes 1024 bytes on disk. One exception however, due to its strong link to disks, is fdisk.

In the old days, the numbers were so small that we could ignore the extra 24 bytes on a KB, but as capacities expand, the more Metric Prefixes and Binary Prefixes diverged, and the difference became non-negligible. At the Terabyte scale, we lose close to 70GB in conversion. For this reason, many folks now use Binary prefixes explicitly to avoid confusion. VMWare has chosen to do exactly this.

Kilo => 10^3
Mega => 10^6
Giga => 10^9
Tera => 10^12

Kibi => 2^10 (1,024)
Mebi => 2^20 (1,048,576)
Gibi => 2^30 (1,073,741,824)
Tibi => 2^40 (1,099,511,627,776)

So, in this case, you have VMWare using MiB, and FDisk using MB, so there will be a mismatch in the figures.

From VMWare's perspective, you asked for 500MiB, and it gave it to you, but from Fdisks perspective it is a 524MB volume. The two values are exactly the same however.

So, for a 500MiB volume, the size calculation is:

500 * 1048576B = 524288000B => 500 MiB which equals 524MB

for a 500MB disk however, the calculation would be:

500 * 1000000B = 500000000B => 500MB which equals 476MiB so you would not be able to store 500MB of actual data in it.

  • or as I like to say "Rounding Errors". It usually happens the other way around tho – Journeyman Geek Sep 4 '15 at 3:36
  • For 1000 use kB not KB (same as the SI-kilo). 2^20 is 1048576 not 10048576. – 12431234123412341234123 Jul 11 '17 at 10:26
  • @12431234123412341234123, thanks. typo corrected. – Frank Thomas Jul 12 '17 at 1:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.