ceturtdiena, 2020. gada 6. augusts

Ubuntu 20 how to increase swapfile

After installing server, I increased RAM, but swap file remains the same, so I have to increase itrmanually. I increased RAM from $ to 8 GB so I have to increase swap file accordingly. In Ubuntu 20.04 swapfile out of the box is called swap.img not swapfile, so the commands will be as follows: 
  • type sudo su so you don't have to type sudo before each command
ubuntu@grayflow:~$ sudo su
[sudo] password for ubuntu:
  • check swap size and name
root@grayflow:/home/ubuntu# swapon --show
NAME      TYPE SIZE USED PRIO
/swap.img file   4G 2.1G   -2
  • turn off swap
root@grayflow:/home/ubuntu# swapoff -a
  • increase swap file
root@grayflow:/home/ubuntu# dd if=/dev/zero of=/swap.img bs=1M count=8192
8192+0 records in
8192+0 records out
8589934592 bytes (8.6 GB, 8.0 GiB) copied, 131.193 s, 65.5 MB/s
  • turn on swapping
root@grayflow:/home/ubuntu# mkswap /swap.img
Setting up swapspace version 1, size = 8 GiB (8589930496 bytes)
no label, UUID=a1dfcfc3-577d-4ed2-b706-f7c8eeeec69f
root@grayflow:/home/ubuntu# swapon /swap.img
root@grayflow:/home/ubuntu# swapon -s
Filename                                Type            Size    Used    Priority
/swap.img                               file            8388604 780     -2

Nav komentāru:

Ierakstīt komentāru