Linux 101 : Extending Swap space on a logical volume



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:

Remark:

Since a swap space can't be modified when it is busy, we would need to turn it off first:


Then, we could extend it by adding 1GB using the below command:


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:


Remark:

To reduce the size of a logical volume, we could either use "lvreduce" or "lvresize".

Comments

Leave as a comment:

Archive