Create a swap partition using LVM
Answer:
To create a swap partition using LVM, you just need a few commands!
1. Create a 1G swap partition
# lvcreate -L 1G -n /dev/vg0/swap0
2. Set up a Linux swap partition
# mkswap /dev/vg0/swap0
3. Enable it
# swapon -s /dev/vg0/swap0
You might also want to put the settings in the /etc/fstab, so it will be mounted automatically when your system boot next time.
# sudo vi /etc/fstab
/dev/vg0/swap0 none swap sw 0 0
Save and restart your system to test if it is working when system reboot.