Creating an LVM2 Logical Volume for Swap

Create the LVM2 logical volume of size 2 GB:
# lvcreate VolGroup00 -n LogVol02 -L 2G

Format the new swap space:
# mkswap /dev/VolGroup00/LogVol02

Add the following entry to the /etc/fstab file:
/dev/VolGroup00/LogVol02   swap     swap    defaults     0 0

Regenerate mount units so that your system registers the new configuration:
# systemctl daemon-reload

Activate swap on the logical volume:
# swapon -v /dev/VolGroup00/LogVol02


To test if the swap logical volume was successfully created and activated, inspect active swap space:
$ cat /proc/swaps
$ free -h

Comentarios