So I tried to increase the swap LV from 8GB to 16GB, but Proxmox web panel doesn't seem to see the change. The LVM increased the space, but Proxmox haven't changed it's panel.
Originally lvdisplay
gave this result:
--- Logical volume ---
LV Path /dev/pve/swap
LV Name swap
VG Name pve
LV UUID DdbXas-7RNA-Is5V-Ness-sLb3-0Rb7-oT7HUh
LV Write Access read/write
LV Creation host, time proxmox, 2018-07-18 21:18:17 +0200
LV Status available
# open 2
LV Size 8.00 GiB <-- Originally
Current LE 2048
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
For extending the swap storage I did this:
root@basement:~# lvextend -L+8G pve/swap
(...)
Logical volume pve/swap successfully resized.
After increasing the space I got this:
root@basement:~# lvdisplay
--- Logical volume ---
LV Path /dev/pve/swap
LV Name swap
VG Name pve
LV UUID DdbXas-7RNA-Is5V-Ness-sLb3-0Rb7-oT7HUh
LV Write Access read/write
LV Creation host, time proxmox, 2018-07-18 21:18:17 +0200
LV Status available
# open 2
LV Size 16.00 GiB <--- Size is increased, right?
Current LE 4096
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
Proxmox shows only 8GB of SWAP space
I have rebooted, but it still shows 8GB in the Proxmox panel.
How can this be solved?
Best Answer
You have to modify the swap metadata to account for the increase in space, which is generally accomplished by re-creating the swap signature on a given block device after resize. This is a generic GNU/Linux thing, not just a Proxmox thing.
Shamelessly copied from the RedHat documentation:
7.2.1. Extending Swap on an LVM2 Logical Volume To extend an LVM2 swap logical volume (assuming /dev/VolGroup00/LogVol01 is the volume you want to extend):
Disable swapping for the associated logical volume:
swapoff -v /dev/VolGroup00/LogVol01
Resize the LVM2 logical volume by 256 MB:
lvm lvresize /dev/VolGroup00/LogVol01 -L +256M
Format the new swap space:
mkswap /dev/VolGroup00/LogVol01
Enable the extended logical volume:
swapon -va
Test that the logical volume has been extended properly:
cat /proc/swaps
free