Extending Swap space on a logical volume:
Swap space is used as a "slower" memory, when the RAM of a system is used to its maximum.
We can add swap space to a logical volume using the below command:
Since a swap space can't be modified when it is busy, we would need to turn it off first:
We prepare our volume for swap usage, using the below command:
Then, we turn our swap space back on, using the below command:
We could check if the swap space was added using the below command:
Reducing Swap space on a logical volume:
To reduce the size of our swap space, once we decide that it is not useful anymore, we can follow the below steps.
We turn off our swap space, so we could modify it:
Then we remove "256M" from its size:
We make our swap space ready again, using the below command:
Then we turn it on to make it available again:
To reduce the size of a logical volume, we could either use "lvreduce" or "lvresize".