Servere cu prea putin SWAP sau chiar deloc, care necesita SWAP. Atunci apare aceasta problema de a face increase la SWAP (fara a da reboot la server).
In acest exemplu eu am 512MB SWAP pe un server cu 16GB RAM.
Deoarece am ceva containere java care ruleaza pe server, si au nevoie de ram+swap, e nevoie de 8GB SWAP:
root@localhost:/root # free -m total used free shared buffers cached Mem: 16050 9484 6566 0 13 46 -/+ buffers/cache: 9424 6626 Swap: 511 0 511
echo 3 > /proc/sys/vm/drop_caches
root@localhost:/root # cat /proc/swaps Filename Type Size Used Priority /dev/mapper/rootvg-swap partition 511 0 -33
swapoff /dev/mapper/rootvg-swap
lvextend -L 8G /dev/mapper/rootvg-swap
mkswap /dev/mapper/rootvg-swap
swapon /dev/mapper/rootvg-swap
(sau swapon -a)
Elibereaza SWAP; mareste partitia; markeaza noua partitia ca SWAP; activam noua partite SWAP ca fiind activa.
root@localhost:/root # free -m total used free shared buffers cached Mem: 16050 9484 6566 0 13 46 -/+ buffers/cache: 9424 6626 Swap: 8191 0 8191