Rāda ziņas ar etiķeti swap. Rādīt visas ziņas
Rāda ziņas ar etiķeti swap. Rādīt visas ziņas

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

pirmdiena, 2012. gada 29. oktobris

Lack of RAM and swap space on Zabbix server

I have heavy loaded Zabbix server, we had 2 GB and it appears we need more, so we added 1 GB RAM but things get worse- swap file is about to end- now what? Zabbix server reports it have no free swap space. Zabbix server must not be stopped because several admins are monitoring country wide systems.

Thanks god I found good manual in internet. http://www.susegeek.com/general/how-to-add-additional-swap-area-in-suseopensuse/ most commands are taken from there. So first check out usage of swap.
free -tom
then check where swap files are located
swapon -s
I use command to look where can I place swapfile
df -h
Command to create 1 GB swap file where /var/swap_1 are place and name of swapfile
dd if=/dev/zero of=/var/swap_1 bs=1024 count=1000000
now we can turn that file onto swapfile
mkswap /var/swap_1
no say to OS to put swap on that file
swapon /var/swap_1
to check out if swap working
free -tom
to make those changes permanent you have to  change fstab file
vi /etc/fstab
 and add something like this
/var/swap_1          swap                 swap       defaults              0 0
"Problemo solved" says penguin. Check out Zabbix console to see if swap file is in use.