Ubuntu – Importance of Swap Partition

diskfilesystemhard driveswapsystem-installation

  • What is the purpose of a swap partition?
  • How do I know I have just enough swap partition? Not too much/little.

My Ubuntu PC is used for typical stuff:

  • Web (email, facebook, etc.)
  • Some movies
  • gaming is rare

Best Answer

The swap partition serves a couple of purposes.

  • It serves as 'backup' RAM. That is, should your computer run out of RAM, it will use the swap area as a temporary source of more memory. More specifically, it will 'swap' unused items from the RAM into the swap area in order to leave spare space for the applications that need it at that instant. This is not ideal as the data transfer rate to the hard drive is significantly lower than that to your normal RAM. In practice this means its much slower to retrieve information from the swap area.

  • It is used when the computer hibernates. Hibernation involves taking an image of the RAM in its current state (like an ISO represents an image), and saves it to the swap area. It then reloads this image when the computer restarts.

  • To be most useful, the swap area should be at least (RAM * 1.5) although more is recommended. For example, on my system with 3gb of RAM, I have a swap area of 7.2gb.