How to create an LVM2 Logical Volume for swap


To add a swap logical volume /dev/rootvg/swap1lv


1. Create the LVM2 logical volume of size 8GB:
lvcreate rootvg -n swap1lv -L 8G

2. Format the new swap space:
mkswap /dev/rootvg/swap1lv

3. Add the following entry to the /etc/fstab file:
/dev/rootvg/swap1lv swap swap defaults 0 0

4. Enable the extended logical volume:
swapon -v /dev/rootvg/swap1lv

To test if the swap logical volume was successfully created, use

cat /proc/swaps




swapon -s

to inspect the swap space.