Kahibaro
Discord Login Register

Swap

What Swap Is (In Practice)

Swap is disk space that your Linux system can temporarily use as "overflow" memory when RAM is full. It is much slower than real RAM, but it:

Swap can be provided in two main ways:

In this chapter, we focus on swap as part of the installation/partitioning process.

Do You Need Swap?

Whether you need swap, and how much, depends mainly on:

Some typical guidelines for beginners:

For hibernation, you usually want swap size at least as large as your RAM (or very close), because the system saves the contents of RAM into swap.

How Much Swap Should You Create?

There is no universal rule, but here are practical starting points:

These are conservative, safe defaults for new users. You can adjust later as you learn more.

Swap Partition vs Swap File (At Install Time)

During installation, many distributions give you a choice between:

Swap Partition

A swap partition is its own partition, with no filesystem, used only for swap.

Pros:

Cons:

Typical when you:

Swap File

A swap file is a regular file on an existing filesystem (often on /).

Pros:

Cons:

Many modern distributions default to a swap file on desktop/laptop installs. If you are unsure, accepting the installer’s default is usually the best choice.

Where to Put Swap

During installation, you’ll see disk layouts. Common scenarios:

  1. Automatic partitioning
    • Installer creates swap automatically:
      • Either a swap partition, or
      • A swap file on the root partition
    • Recommended for beginners unless you have special needs.
  2. Manual partitioning
    • You create partitions yourself.
    • For swap, you typically:
      • Create a new partition
      • Set its type to swap or Linux swap
      • Do not assign a mount point (swap doesn’t get mounted like / or /home)

If you plan to use a swap file instead of a partition, you can:

Swap and Hibernation

If you intend to use hibernation:

When installing:

Common Installation-Time Choices

Here are some safe, simple choices for typical beginners:

Example 1: 8 GB RAM laptop, single-disk, wants hibernation

Example 2: 16 GB RAM desktop, no hibernation

Example 3: Small VM with 2 GB RAM

Things to Avoid (As a Beginner)

Summary

Views: 24

Comments

Please login to add a comment.

Don't have an account? Register now!