What is swap?

  • Swap is RAM that is emulated on disk
  • All Linux systems should have at least some swap. but when installing Kubernetes you will disable it. Swapoff
  • The amount of swap depends on the use of the server

Create swap

  • Swap can be created on any block device, including swap files
  • Set partition type to linux-swap
  • After creating the swap partition, use mkswap to create the swap FS
  • Activate using swapon
fdsik partition#option n and t then w
mkswap partition
swapon partition
/etc/fstab
mount -a

#create the partiton
fdisk /dev/sda
n
7
+2G
p
 
#format the partiton
t
7
L
swap or 82
p
 
#change the partiton order not necessary
m
x
m
f
r
p
 
#write the changes
w
reboot
 
#after the reboot
lsblk
fdisk -l /dev/sda
free -m
mkswap /dev/sda7
swapon /dev/sda7
free -m
 
#make the swap persistent
vim /etc/fstab