I'm currently trying to resize my swapspace on a Proxmox VE server with LVM volumes, as I'm running out of space for LVM snapshots and the swapspace is fairly oversized:
root@rb-srv-gus:~# free -m
total used free shared buffers cached
Mem: 64394 63917 477 0 1515 39772
-/+ buffers/cache: 22629 41764
Swap: 63487 0 63487
Unfortunately, this seems to take forever or doesn't seem to work at all. After issuing
swapoff /dev/mapper/pve-swap
, the output changes to
root@rb-srv-gus:~# free -m
total used free shared buffers cached
Mem: 64394 63935 459 0 1516 39773
-/+ buffers/cache: 22646 41748
Swap: 0 0 0
after a moment, but the swap usage stays at 724 KB and the command still keeps running:
root@rb-srv-gus:~# free
total used free shared buffers cached
Mem: 65940084 65458864 481220 0 1553808 40736120
-/+ buffers/cache: 23168936 42771148
Swap: 724 724 0
root@rb-srv-gus:~# cat /proc/meminfo |grep Swap
SwapCached: 4 kB
VirtualSwap: 197852 kB
SwapTotal: 724 kB
SwapFree: 0 kB
root@rb-srv-gus:~# vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
2 0 724 449644 1552856 40730996 0 0 112 87 0 1 4 1 94 0
I've been waiting for more than an hour, the command is still running and the Swap still at 724 kB. As soon as I cancel via Strg-C, the swapspace is back to 62 GB.
What I did now was resizing the swap partition to 16 GB without the swapoff:
--- Logical volume ---
LV Path /dev/pve/swap
LV Name swap
VG Name pve
LV UUID UKlpwX-Y6VJ-APsa-toOW-n219-gW0j-BQEm83
LV Write Access read/write
LV Creation host, time proxmox, 2014-03-27 12:06:14 +0100
LV Status available
# open 2
LV Size 16,00 GiB
Current LE 4096
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
, but free -m
still shows 64 GB for swap. Any ideas what I could do apart from waiting some more hours for swapoff
to complete or rebooting?
EDIT:
After creating a temporary swapfile as HBruijn suggested, the server uses this swapfile as well but there are still 724 KB used on the original swap volume:
root@rb-srv-gus:~# cat /proc/swaps
Filename Type Size Used Priority
/dev/dm-1 partition 65011704 724 -2
/root/swapfile file 10232 1328 -1
swapoff
command is still running...