LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-01-2021, 12:03 PM   #1
overkill
LQ Newbie
 
Registered: Jul 2021
Posts: 24

Rep: Reputation: Disabled
GIB & MIB vs. GB and MB


Hi guys. Is there an easy way to convert MIB and GIB to GB and MB, so I get an exact size that I want like 30GB? It's very confusing with some installers.

Last edited by overkill; 08-01-2021 at 12:03 PM. Reason: text error
 
Old 08-01-2021, 01:38 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,534

Rep: Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383
Yes. Enter the terms in a search engine.

The problem arises because 1000 or 1K is mathematically used, but electronics uses 1024. So 1 Megabyte=1024*1024 and ever multiple is just multiplied by 1024. Gigibytes are a marketing ploy to save tome silicon but it makes very little odds.

Last edited by business_kid; 08-01-2021 at 01:50 PM.
 
Old 08-01-2021, 03:56 PM   #3
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,688

Rep: Reputation: Disabled
Code:
$ units -t 30GB GiB
27.939677
$ units -t 30GiB GB
32.212255
So, 30 GB ≈ 27.94 GiB and 30 GiB ≈ 32.21 GB

Obviously, units is not the only possibility. E.g., numfmt which is part of GNU coreutils since 8.21 (Feb 2013):
Code:
$ numfmt --from=si --to=iec --round=nearest 30G
28G
$ numfmt --from=iec --to=si --round=nearest 30G
32G
or Qalculate!
Code:
$ qalc -t 30Gbyte to Gibyte
27.939677 gibibytes
$ qalc -t 30Gibyte to Gbyte
32.212255 gigabytes
And as long as you are comfortable with doing conversions yourself, pretty much any calculator will do:
Code:
$ bc<<<'scale=1;30*10^9/1024^3'
27.9
$ bc<<<'scale=1;30*1024^3/10^9'
32.2
$ dc -e '1k10 9^30*1024 3^/p'
27.9
$ dc -e '1k1024 3^30*10 9^/p'
32.2

Last edited by shruggy; 08-02-2021 at 07:15 AM.
 
Old 08-02-2021, 04:01 AM   #4
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,541

Rep: Reputation: Disabled
Basically, all you need to know is that manufacturers use MB, because you get more of them, than you do with genuine standard computer sizing (MiB), which is 1024 as against 1000 units used by manufacturers - just a marketing ploy.
 
Old 08-02-2021, 04:15 AM   #5
overkill
LQ Newbie
 
Registered: Jul 2021
Posts: 24

Original Poster
Rep: Reputation: Disabled
I was never good in math
 
Old 08-02-2021, 04:21 AM   #6
overkill
LQ Newbie
 
Registered: Jul 2021
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by business_kid View Post
Yes. Enter the terms in a search engine.

The problem arises because 1000 or 1K is mathematically used, but electronics uses 1024. So 1 Megabyte=1024*1024 and ever multiple is just multiplied by 1024. Gigibytes are a marketing ploy to save tome silicon but it makes very little odds.
Yea I have done that, but it's still a bit confusing.

4 GB = 3814.7 MIB

4 GB = 3.725290298 GiB

In the above example, for my swap, do I put 3725 GIB or 3814 MIB in the partitioner?
 
Old 08-02-2021, 04:45 AM   #7
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,158

Rep: Reputation: 7377Reputation: 7377Reputation: 7377Reputation: 7377Reputation: 7377Reputation: 7377Reputation: 7377Reputation: 7377Reputation: 7377Reputation: 7377Reputation: 7377
Quote:
Originally Posted by overkill View Post
Yea I have done that, but it's still a bit confusing.

4 GB = 3814.7 MIB

4 GB = 3.725290298 GiB

In the above example, for my swap, do I put 3725 GIB or 3814 MIB in the partitioner?
usually none of them. You will tell the first/last sector. That's all. You do not need to know if it was exactly 3.73452345 GB or 3.783456245 GB (or anything else).
 
Old 08-02-2021, 05:44 AM   #8
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,688

Rep: Reputation: Disabled
Quote:
Originally Posted by overkill View Post
In the above example, for my swap, do I put 3725 GIB or 3814 MIB in the partitioner?
1) Don't forget the decimal point: 3814MiB=3.725GiB;
2) For swap size, I'd prefer "round" "binary" numbers anyway, i.e. 4GiB or 4096MiB.¹
________
¹ When dealing with computers, I perceive powers of two rather than powers of ten as round numbers. So e.g. 4096 to me is a nice, perfectly round number, while 4000 not so much. FYI, 1GiB=1024MiB=1048576KiB

Last edited by shruggy; 08-02-2021 at 05:51 AM.
 
Old 08-02-2021, 01:33 PM   #9
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,541

Rep: Reputation: Disabled
Quote:
Originally Posted by overkill View Post
..... for my swap, do I put 3725 GIB or 3814 MIB in the partitioner?
Just put 4G, the partitioner will give you a size as near as possible, which is all that you would need.
 
Old 08-03-2021, 01:57 PM   #10
overkill
LQ Newbie
 
Registered: Jul 2021
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by fatmac View Post
Just put 4G, the partitioner will give you a size as near as possible, which is all that you would need.
I know but i'm a perfectionist lol I like it to be even numbers and what I want not near as possible

Last edited by overkill; 08-03-2021 at 01:58 PM. Reason: mistake
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HDD FROZEN - 17 GiB - missing!! Trying to create multi-boot system! nitid Linux - Newbie 7 12-11-2010 12:02 AM
ifconfig RX and TX packets resets at 4 Gib oddo Linux - Networking 1 06-16-2008 01:40 PM
Strange units in conky (KiB, MiB, GiB) chilebiker Linux - Software 1 05-04-2007 12:44 PM
128 GiB ATA limit on old hardware with old OS version jp413 Linux - Hardware 1 05-29-2005 12:21 AM
Gotta love those &#1649;&#1649;&#1649;&#1649;&#1649;&#1649;&#1649;&# iLLuSionZ Linux - General 5 11-18-2003 07:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration