6

I read that the swap partition must have the double size of your RAM, that is optional to install, that is for hibernation mode only, several technical information that tells me what to do. I am using linux (Ubuntu at the moment).

Could anyone explain better swap partition?

Like:

  • What is
  • What is for
  • When should I use
  • Why should I use
  • How to partition correctly
  • Pros/ Cons to add this to system
  • Parts of your question are difficult to answer without knowing what is your operating system... – DavidPostill Oct 19 '14 at 15:24
  • & other parts seem to be confusing the swap file with the hibernation file – Tetsujin Oct 19 '14 at 15:26
  • 2
    You should read paging and All about Linux swap space – DavidPostill Oct 19 '14 at 15:27
  • I edited adding the OS at the question... – lcsvcn Oct 19 '14 at 15:28
  • It should be noted that "swap partition" is a general term whose specific meaning depends on the OS in use. Original UNIX had a swap partition (or, more likely, an entire disk or two) where entire process images were swapped in and out, in order to multitask in a box with no memory mapping capability. Other systems use a "paging store" which is similar to the Windows "swap partition" and is used to swap in and out individual storage pages. – Daniel R Hicks Oct 20 '14 at 2:08
8

The main ideas before you dive into some guides if you feel like it to learn more details:

What is

It's a special type of partition (sometimes OSes simply use one giant swap file).

What is for

The swap partition is used by an OS to artificially increase the size of the memory.

When should I use

When you think that the size of your physical memory (a.k.a. RAM) won't to be enough to run all the programs you plan to use.

Why should I use

Because you don't want programs to crash because they are out of memory.

Pros/ Cons to add this to system

  • Pro: artificially increase the size of the memory, meaning that you could run more programs that you have done without it.
  • Con: disks much slower than RAM
  • The 'double your RAM' guideline is for Windows; Linux folk generally recommend only the same disk space as your RAM size. I run without a real swap partition, for I have an SSD instead of a spinning drive, aka HDD. – K7AAY Oct 19 '14 at 18:05
  • @K7AAY - Back before RAM was so plentiful, the 2X RAM guideline applied even to unix (and unix-like) operating systemsbbb. I remember that being a guideline back when I was provisioning SunOS machines. I tried to find a reference, but the guideline is so prolific that I can't find anything that predates Linux. Nowdays on many VM's I don't provision swap at all since I don't want swapping to the already busy SAN. I'd rather that the application fail due to OOM than to have swapping. – Johnny Oct 20 '14 at 0:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.