0

I'm sorry for asking something as elementary, but the information is very confusing and, even when there are ISO recommendations, not everybody follows them.

The manufacturer says my laptop has "8GB DDR4 system memory" and I want to set a swap partition with EXACTLY that size + a small margin, but the version of gparted my distro uses (Ubuntu 16.04) requires me to enter a size in "MB".

To put things worse, that same gparted says my hard drive is "1000204 MB" in size whereas the manufacturer says "1 TB" and I have tried to derive from that the exact definition Ubuntu is using of a MB but without success.

Mephisto
  • 1,077

1 Answers1

1

The command free -m will give you the size in MiB (2^20 bytes per MiB) and the command free -mega will give you the size of your RAM in MB (10^6 bytes per MB) There are other options: man free

You will probably want MiB for gparted, as it doesn't use MB. An alternative to using gparted is to create a swapfile. That may be more convenient a guide by digital ocean

Perhaps you should finally note that on a system with 8GB of ram, you probably won't need much swap (though it depends on what you do with your computer). There is no general reason that the swap size should match the physical memory size exactly or even roughly. This is discussed elsewhere.

James K
  • 288
  • For hibernation the swap partition/file must be at least as large as RAM, but I agree that there is no good reason for them to be the same size. – Ignacio Vazquez-Abrams Feb 05 '18 at 06:02
  • @IgnacioVazquez-Abrams Well, please correct my logic if I am wrong but, for hibernation to work properly in any circumstance, you want the swap to be at least as big as the RAM. And to avoid wasting hard drive space (yes, I know it's cheap these days...) you want it to be small. Hence, the same exact size as the RAM plus a small margin of a few bytes to be on the safe side. – Mephisto Feb 05 '18 at 06:32
  • @Mephisto: If you're worried about hard disk space then you don't want any swap, and you learn to live with sleeping. – Ignacio Vazquez-Abrams Feb 05 '18 at 06:33
  • Let's not go over the "how much swap" discussion here. The answer is always "it depends". If you use a swapfile you can create swap space with any size you like, even exactly 8MiB, if that is your decision. – James K Feb 05 '18 at 06:40
  • Let's not go over the "how much swap" discussion here. The answer is always "it depends". If you use a swapfile you can create swap space with any size you like, even exactly 8MiB, if that is your decision. – James K Feb 05 '18 at 06:40
  • @IgnacioVazquez-Abrams You only learn to live with sleeping if you are connected to the AC outlet all the time. Not when you are using the battery and want to hibernate in order to change the battery and keep on working as you left it. – Mephisto Feb 05 '18 at 06:42