Linux 101 : Creating a Swap space on an LVM volume



Creating a swap space on an LVM volume:

We start by creating our logical volume - Log-Vol-swap - inside our volume group - VolGroup-swap - ( Size : 1G ) :


We prepare it for use, using the below command:


To be able to be mounted and used at boot time, we mention it in the "/etc/fstab" file as below:


We do a soft reload of our systemd daemon - systemctl daemon-reload -, so that the changes take effect.

Then, we turn on our swap space, using the below command:


We could check our newly created swap space in the "/proc/swaps" file:


If we decide that there is no use for our swap space anymore, we could delete it using the below steps:


Then we would have to delete the above line that we added in the  "/etc/fstab
file.

Finally, we reload our services, so that the changes take effect:


Comments

Leave as a comment:

Archive