0

For example, I've just downloaded a file that's 4.67 GiB.

In Windows 10, when I go into the properties, it lists the following:

Showing as 5,023,979,520 bytes

Size on disk is 5,023,981,568 bytes

On Linux, it's listed as 5,023,979,520 bytes.

When you use an online calculator to convert to 4.67 GiB to bytes, you get 5014374318.08.

Can anyone explain why there's a difference here? I'm guessing it's potentially overhead added by the respective file systems? NTFS and EXT4 are showing the same size.

Will
  • 11
  • 1
  • 4
  • What difference do you mean exactly? Between 5023979520 and 5014374318.08? Between 4670000000 and 5023979520? At this moment one of the answers even tries to explain the difference between 5023979520 and 5023981568 ("size" vs "size on disk"). Please [edit] and be specific. – Kamil Maciorowski Mar 05 '23 at 19:32
  • 1
    This question is very poorly asked.. as Kamil points out.. THere are 3 different numbers you gave. Obviously all from an OS. A way to improve this question would be if you asked for an explanation of the THREE different numbers. That way you wouldn't be invalidating answers already given. – barlop Mar 05 '23 at 19:40
  • @barlop OTOH it should be "one question per question". And we already have good Q&A for ["1000 vs 1024"](https://superuser.com/q/373579/432690) and ["size vs size on disk"](https://superuser.com/q/66825/432690), so at least partially the "improved" question would be a duplicate. – Kamil Maciorowski Mar 05 '23 at 19:48
  • Asking what the difference is between those three numbers would be one question. And the answer would take the form of this aspect is answered here and that aspect is answered there. – barlop Mar 06 '23 at 01:24
  • Apologies, I could have worded it better but after re-reading it, it still makes sense to me. – Will Mar 06 '23 at 23:25
  • "after re-reading it, it still makes sense to me" – I believe you, but… I have written many answers here; plus other posts elsewhere, several short stories and a novel (awful, never published). I can assure you the author's perception is almost always biased because the author already knows what he or she wanted to communicate. It's almost impossible to read your own fresh text like you were a random reader. Take a break, genuinely forget the details and return after three months. You may find some parts of your own text cryptic, ambiguous or prone to different interpretation. This happens. – Kamil Maciorowski Mar 07 '23 at 00:03
  • @Will if you see that you could have worded it better then you should have worded it better. This site is not a help site, it's a question and answer site. So people look up questions to find answers. The questions should be high quality, and well worded. as well as one reasonably can. – barlop Mar 07 '23 at 13:18

2 Answers2

2

5023979520 B is the exact value. It was converted to gibibytes and apparently rounded (down) to two decimal places. The result is 4.67 GiB and it's an approximate value because of rounding.

# in Linux
$ dc -e '2k 5023979520 1024 3 ^ / p'     # 2k sets precision, the rest is math in RPN
4.67

5023979520 B is exact, 4.67 GiB is approximate. Not the other way around.

If you do it the other way around, i.e. if you treat 4.67 GiB as the exact value and convert it to bytes, then yes, you will get 5014374318.08 B.

# in Linux
$ dc -e '2k 4.67 1024 3 ^ * p'     # 2k sets precision, the rest is math in RPN
5014374318.08

Now if you realize 4.67 GiB was an approximation in the first place, then you will acknowledge that 5014374318.08 B must be an approximation to a similar degree.
Indeed 5014374318.08 = 5023979520 ±1%.

Kamil Maciorowski
  • 69,815
  • 22
  • 136
  • 202
1

You are confused between GB (Gigabyte) - 1000 & GiB (Gibibyte) - 1024. See "gigabyte" on Wikipedia.

If you take 5,023,979,520 and continually divide by 1024, you get to 4.6789455413818359375 GiB - give or take a fraction.

For the size on disk, you have to think about block sizes, where the remainder of a file, even if a few bytes, will take up a full block. This is what will happen for many filesystems. However, there are a few filesystems which will use an alternative method of storing those few remainder bytes, usually within the inode structure, especially on Linux.

Therefore if you take 5,023,981,568 and divide it by 4,096, you will get 1,226,558 exactly. This means that the file is taking up that exact amount of 4,096 byte blocks.

Kamil Maciorowski
  • 69,815
  • 22
  • 136
  • 202
Bib
  • 1,175
  • 1
  • 6
  • 8
  • 1
    This is probably all true, except the first sentence. The factor 1000 has nothing to do with the OP's confusion. Take 4.67 and multiply by 1024 three times, the result is *exactly* 5014374318.08 B. This is how the number 5014374318.08 was calculated. It's not a matter of 1024 vs 1000 *at all*. – Kamil Maciorowski Mar 05 '23 at 18:43
  • @KamilMaciorowski The op is confused between GB & GiB, take the first 3 lines. That 4.67 is an approximation. I gave an accurate number. If the OP had taken that and popped it in the online calculator, then it would have come out to 5,023,979,520. You just seem to be trying to make pointless points. You came from one direction, I came from the other. – Bib Mar 05 '23 at 18:49
  • "That 4.67 is an approximation" – Exactly the point of my answer. Your answer starts from this "1000 vs 1024" confusion, which is often a case, but not here. 1000 was not a factor in the calculations in question. – Kamil Maciorowski Mar 05 '23 at 18:54
  • Take 5023979520 (or 5023981568) or 5014374318.08. Using the factor 1000 give me 4.67, I dare you. :) Only if you manage to do this, I will agree "1000 vs 1024" may explain the confusion. These numbers are connected by 1024 and rounding only. – Kamil Maciorowski Mar 05 '23 at 19:01
  • @KamilMaciorowski He was confused then used the online to help with that, not the other way around. Why the bullying and now you are taking other answers and misappropriating them as your own.? – Bib Mar 05 '23 at 19:16
  • The title is "Can anyone explain the difference between data size shown in an OS compared to an online calculator?". The number from the OS is 5023979520. The number from the online calculator is 5014374318.08. But yes, in the question body it's not clear what difference the confusion is about. Now the answers explain "size vs size on disk", "1000 vs 1024", rounding. I'm revoking my downvote and I'm going to ask the OP. – Kamil Maciorowski Mar 05 '23 at 19:26
  • It was a Linux ISO that I downloaded via BitTorrent, the file size is shown as 4.67GiB in Qbitorrent's GUI. The Thunar file manager lists the same. – Will Mar 06 '23 at 23:22