MiB, GiB, etc. used but displayed as MB, GB, etc. (SI prefixes) #6224

Closed
opened 2025-12-29 19:38:12 +01:00 by adam · 7 comments
Owner

Originally created by @juliusrickert on GitHub (Mar 17, 2022).

NetBox version

v3.1.9

Python version

3.9

Steps to Reproduce

  1. Open form to create a new VM (Virtualization > Virtual Machines > Add)
  2. Enter 8000 MB for memory and 1000 GB for disk size
  3. Click "Save"

Expected Behavior

NetBox creates a VM with 8 GB of memory and 1 TB of disk space.

Observed Behavior

NetBox indicates that the VM would have 7 GB of memory and 1000 GB of disk space.

It's clear that this behaviour is due to NetBox operating on MiB, GiB, etc. instead of MB and GB (the SI prefixes).

I want to suggest changing the units displayed in the web frontend to MiB, GiB, etc. to make NetBox's assumptions clear.

Originally created by @juliusrickert on GitHub (Mar 17, 2022). ### NetBox version v3.1.9 ### Python version 3.9 ### Steps to Reproduce 1. Open form to create a new VM (Virtualization > Virtual Machines > Add) 2. Enter 8000 MB for memory and 1000 GB for disk size 3. Click "Save" ### Expected Behavior NetBox creates a VM with 8 GB of memory and 1 TB of disk space. ### Observed Behavior NetBox indicates that the VM would have 7 GB of memory and 1000 GB of disk space. It's clear that this behaviour is due to NetBox operating on MiB, GiB, etc. instead of MB and GB (the SI prefixes). I want to suggest changing the units displayed in the web frontend to MiB, GiB, etc. to make NetBox's assumptions clear.
adam added the type: featurestatus: duplicate labels 2025-12-29 19:38:12 +01:00
adam closed this issue 2025-12-29 19:38:12 +01:00
Author
Owner

@DanSheps commented on GitHub (Mar 18, 2022):

(Ignore all the previous changes, this is the last one)

I think the labels are fine, what I think we should do is send everything to be normalized into a common prefix (B, KB, MB, GB, etc) in the database and use a helper function to "humanize" it. Maybe add some info text somewhere specifying what each unit is. I don't label this as a bug though, it is just a misunderstanding of the fundamental units of computing if someone gets tripped up.

Most people know disk space is in base 10 (but display is base 2 in some instances) and memory is normally counted in base 2. In this case, MB/GB/TB can be seen as a synonym in this case for that. I wouldn't create a VM with 7000MB of RAM, I would either select "7GB" or 7168.

@DanSheps commented on GitHub (Mar 18, 2022): (Ignore all the previous changes, this is the last one) I think the labels are fine, what I think we should do is send everything to be normalized into a common prefix (B, KB, MB, GB, etc) in the database and use a helper function to "humanize" it. Maybe add some info text somewhere specifying what each unit is. I don't label this as a bug though, it is just a misunderstanding of the fundamental units of computing if someone gets tripped up. Most people know disk space is in base 10 (but display is base 2 in some instances) and memory is normally counted in base 2. In this case, MB/GB/TB can be seen as a synonym in this case for that. I wouldn't create a VM with 7000MB of RAM, I would either select "7GB" or 7168.
Author
Owner

@DanSheps commented on GitHub (Mar 18, 2022):

I lied, one last change, as this would likely result in a API change if we normalized, we would need to wait for a major version

@DanSheps commented on GitHub (Mar 18, 2022): I lied, one last change, as this would likely result in a API change if we normalized, we would need to wait for a major version
Author
Owner

@minitriga commented on GitHub (Mar 18, 2022):

@DanSheps This may be resolved with the implementation of #8437. I have implemented dropdowns so the user can select MB, GB, TB options for memory. We could change this so that it includes Disks?

@minitriga commented on GitHub (Mar 18, 2022): @DanSheps This may be resolved with the implementation of #8437. I have implemented dropdowns so the user can select MB, GB, TB options for memory. We could change this so that it includes Disks?
Author
Owner

@juliusrickert commented on GitHub (Mar 18, 2022):

memory is normally counted in base 2

Normally. I think NetBox shouldn't care about that.
k, M, G, etc. are SI prefixes and should correspond to the respective multiple of 1000, no matter the context.

To be clear, I wouldn't mind NetBox being opinionated about this and only allowing MiB, GiB, etc. for memory, at least for the time being.

Looking ahead, I think that Kubernetes solves quanities quite nicely. NetBox could opt for a similar serialisation, 8 GB as "8G", 8 GiB as "8Gi", and 1.5 GiB as "1536Mi", in the database.

We could change this so that it includes Disks?

Sure, why not. Please make sure to use SI prefixes for the disk space.
Currently, there is no "pretty printing" for the disk space, e.g., 1 TB is shown as 1000 GB. That should probably be added along with that.

@juliusrickert commented on GitHub (Mar 18, 2022): > memory is normally counted in base 2 Normally. I think NetBox shouldn't care about that. k, M, G, etc. are SI prefixes and should correspond to the respective multiple of 1000, no matter the context. To be clear, I wouldn't mind NetBox being opinionated about this and only allowing MiB, GiB, etc. for memory, at least for the time being. Looking ahead, I think that Kubernetes solves [quanities](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/) quite nicely. NetBox could opt for a similar serialisation, 8 GB as "8G", 8 GiB as "8Gi", and 1.5 GiB as "1536Mi", in the database. > We could change this so that it includes Disks? Sure, why not. Please make sure to use SI prefixes for the disk space. Currently, there is no "pretty printing" for the disk space, e.g., 1 TB is shown as 1000 GB. That should probably be added along with that.
Author
Owner

@DanSheps commented on GitHub (Mar 18, 2022):

Normally. I think NetBox shouldn't care about that.
k, M, G, etc. are SI prefixes and should correspond to the respective multiple of 1000, no matter the context.

NetBox should because computer systems do.

For example, if you buy a memory chip, that memory chip is giving you quantities of "base 2" even though it says "8GB" it is really 8192MiB or 8388608 KiB or 8589934592 B. While yes, there is a ratafied standard for GB vs GiB, it is not widely adopted by end users and most technical people still refer to memory in terms of GB where it is really GiB.

I think including the other prefix in certain areas is going to confuse people in the end.

We could change this so that it includes Disks?

We can but we should probably do it as a separate FR maybe, let me see. You are all good @minitriga

@DanSheps commented on GitHub (Mar 18, 2022): > Normally. I think NetBox shouldn't care about that. > k, M, G, etc. are SI prefixes and should correspond to the respective multiple of 1000, no matter the context. NetBox should because computer systems do. For example, if you buy a memory chip, that memory chip is giving you quantities of "base 2" even though it says "8GB" it is really 8192MiB or 8388608 KiB or 8589934592 B. While yes, there is a ratafied standard for GB vs GiB, it is not widely adopted by end users and most technical people still refer to memory in terms of GB where it is really GiB. I think including the other prefix in certain areas is going to confuse people in the end. > We could change this so that it includes Disks? We can ~~but we should probably do it as a separate FR maybe, let me see.~~ You are all good @minitriga
Author
Owner

@DanSheps commented on GitHub (Mar 18, 2022):

Going to close this out as a duplicate of #8437

@DanSheps commented on GitHub (Mar 18, 2022): Going to close this out as a duplicate of #8437
Author
Owner

@DanSheps commented on GitHub (Mar 18, 2022):

Duplicate of #8437

@DanSheps commented on GitHub (Mar 18, 2022): Duplicate of #8437
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6224