1000MB is not 1GB
I had an interesting situation come up yesterday that I thought would be worth writing about.
As a web host here at www.orcsweb.com, we offer disk space, but obviously need to set some type of limits. One of our clients had an allotment of 1,140 MB. (That is an odd number, but that's what it worked out to.) While working with him a couple of weeks ago, I checked his disk usage by right-clicking on the folder in windows explorer and clicking on properties. The space that it told me was 1.14GB, which I relayed on to the client. So far so good, it seemed that he was right at his limit.
Yesterday, an automated process checked the disk usage on his site, calculated his usage at 1,170MB and sent him an email asking for him to address the disk space or increase his allotment. He was confused, and rightfully so, because I had just told him that he was at 1.14GB, and he was confident that nothing was added since our conversation.
So, I started digging. I checked the database information which is what the script utilized and say that it has been at 1,170MB every day for a while. So, I pulled apart our automated script to see why it said 1,170MB but windows explorer/properties said 1.14GB. I even created a 5 line VBScript script using FileSystemObject to see what it returned, and sure enough, it returned 1,170MB. I was confused and looked at the numbers for a bit, then realized that I had overlooked the obvious. It's something I know well, but it didn't click at first.
1GB is actually 1024MB. It's not an even 1000. People will often say that it's 1000, but that's just a rounded number. In day to day situations, it may not even matter too much, people are often wondering about their usage in general terms, not something so precise. But, in this case, one number was under his limit and one was over his limit so it was important to figure out the issue.
Check it out: The size is actually 1,227,418,765bytes, so we'll take that divided by 1024 (for KB) divided by 1024 (for MB) and divided by 1024 (for GB). We get: 1.1431228. That matches the size of 1.14GB shown. Now, multiple that by 1024 and we get 1,170MB. The 24MB that was lost in rounding made a big different in this case!
So, nothing was wrong in the script, it calculated the information correctly, but from the windows explorer/properties view, the 1024 instead of 1000 made enough of a difference that it threw us off at first.
I was able to work out something on the disk space that worked for both of us and everyone is happy, plus this serves as a good reminder about the real difference between 1GB and 1000MB.