1

I upgraded from Debian 10 to 12 (going through 10->11->12), and I noticed that on my server (with 2GB of RAM) i get mysql OOM kills from time to time (In Debian 10 I did not have any issue with OOM). I am planning to add more RAM (it is a Virtual Private Server in the cloud) but I also noticed that by default Debian has not created a swap partition/file:

free -h
               total        used        free      shared  buff/cache   available
Mem:           1.9Gi       804Mi       139Mi       6.0Mi       1.1Gi       1.1Gi
Swap:             0B          0B          0B

I have other servers with Ubuntu and the swap allocation was defined by default (I do not recall adding it). This is not the default for Debian?

Now I am willing to add the swap, but most of the tutorials I found create a swap file, while the partition is the recommendation. Can you guys give some instructions on how to create the swap partition, and what should be the size (my SDD has 40GB)?.

Thanks

1 Answer 1

0

Some references:

  1. Create a partition in your storage of type "Linux swap" (with fdisk).
    fdisk /dev/sdX

    -> p > n > p > 1 > t > 1 > 82 > w

BE VERY CAREFUL TO NOT ERASE YOU SYSTEM DATA AND TO CREATE IT IN AN "EMPTY" SPACE.

  1. Initialize the partition as a swap partition:

    mkswap /dev/sdX1

  2. Enable swapping to the swap partition:

    swapon /swapfile

Also, you may consder making it persistent across reboots by adding the following to your /etc/fstab: `/dev/sdX1 swap swap defaults 0 0

You must log in to answer this question.

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