Situatie
Am intalnit servere cu prea putin SWAP sau chiar deloc, care necesita SWAP, si 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:
Solutie
Cod:
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
Cod:
echo 3 > /proc/sys/vm/drop_caches
Cod:
root@localhost:/root # cat /proc/swaps
Filename Type Size Used Priority
/dev/mapper/rootvg-swap partition 511 0 -33
Cod:
swapoff /dev/mapper/rootvg-swap
Cod:
lvextend -L 8G /dev/mapper/rootvg-swap
Cod:
mkswap /dev/mapper/rootvg-swap
Cod:
swapon /dev/mapper/rootvg-swap
(sau swapon -a)
Elibereaza SWAP; mareste partitia; markeaza noua partitia ca SWAP; activam noua partite SWAP ca fiind activa.
Cod:
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
Leave A Comment?