17

When selecting the partition to use manually, you can enter the size of the partition. So my question is, if I want 8GB swap size for my 8GB ram (yes I know the FAQs about the size of the swap etc) , am I supposed to select 8000MB as in 1GB = 1000MB or 8192 as in 1GB = 1024MB?

14
  • 9
    I do not think you are going to see much difference between those options. If you have the space go slightly larger.
    – Panther
    Sep 17, 2017 at 15:48
  • 4
    My question is just if 8000MB is enough for my RAM of 8GB or if I have to enter 8129 to "fully" support the size of my RAM
    – Mason
    Sep 17, 2017 at 15:59
  • 1
    Doesn't make a notable difference. For a home computer probably even 4 or 2 GB would be enough.
    – Byte Commander
    Sep 17, 2017 at 15:59
  • 1
    8000 will be enough even for hibernating.
    – Pilot6
    Sep 17, 2017 at 16:08
  • 1
    The 8000 vs 8192 involves two different measurements of bits. The binary form is XiB, with X being a size (K, M, G, T, etc), and each size being the previous * 1024, thus 8192MiB for 8GiB. Decimal is the same, but each size is the previous * 1000, and is expressed in _B instead of _iB. If your computer reports 8GiB of RAM in a terminal, do 8192MiB. If it reports some other odd number, do 7629MiB.
    – FireFaced
    Sep 17, 2017 at 16:29

2 Answers 2

35

TL;DR: It does not really matter.

RAM is universally measured in powers of 2. This is often written as GiB, so 8GiB is 8*1024=8192MiB RAM.

If you look at physical RAM chips they'll always come in powers of two, e.g. 1024MiB, 2048, 16384MiB etc.

Hard drives are typically measured in powers of ten, using SI prefixes, for instance, 80GB = 80*1000MB.

So 8GiB of RAM is 8192MiB of RAM. For swap, you typically want a swap space that is big enough to hold all of RAM for suspension, so 8192MiB would be the safe option. Note that it really doesn't matter, as Linux will almost never use 100% of RAM anyway; a lot will be used for caching and so on, which will not be saved when you hibernate.

11
  • 5
    8192 MiB is rather unhelpful. Yes, 8 GiB is 8192 MiB, but harddisks don't use GiB or MiB. 8 GiB is 8590 MB.
    – MSalters
    Sep 18, 2017 at 8:26
  • 4
    Hard drive vendors do not use MiB, but software most commonly does.
    – vidarlo
    Sep 18, 2017 at 8:27
  • 8
    I really wish they hadn't confused things by introducing gibibytes and redefining gigabytes.
    – user738156
    Sep 18, 2017 at 10:43
  • 2
    @hvd windows use GiB but write GB. Sep 18, 2017 at 12:13
  • 3
    The statement "Linux will almost never use 100% of RAM anyway" is misleading because this fact does not have much to do with the problem being solved here. --- Linux uses virtual memory which means that the running applications can use more memory than what is actually available as physical RAM. Not all of this memory needs to be stored to the swap when we are freeing RAM but it could easily happen that the amount which has to be stored to the swap will higher than the size of the physical RAM. Sep 18, 2017 at 14:20
-1

It can matter very much, which size the swap-drive is. My swap-drive is a partition shared by all ten (10) of my multi-booting Linux operating systems. If the swap-drive is on the motherboard's spinning HDD, the sector-cluster is fixed by the physical sizes on the spinning disk. If the swap-drive is on a flash-drive or SSD, the size is "electronic" rather than physical, so it matters much less if the size is exactly of factor of 512 bits.

Using "gparted" or similar, allows seeing the effects of choosing the wrong partition size. A strange unused partition appears if the wrong numbers are chosen. Often changing his to upsize or down-size will make these strange left-over partitions disappear.

In Linux with 16 GB of DDR3 memory on m Dell notebook, the swap partition is never used by the Linux operating systems. However, when running "live" Linux operating systems, it may be used or needed.

Swap partitions in Linux behave differently in Microsoft Windows. My Dell notebook has also three (3) Windows-10 operating systems as well. Even though the setting is zero swap partitions, Windows-10 always will demand a swap partition on the booting partition. So I create a tiny, fixed size partition there. The on-board SSD has a variable swap-file on it, to be shared by all Windows-10 operating systems.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .