Following steps to add swap using LVM with out creating new partition
1) Check if you have enough space in the volume group
[root@kumar ~]# vgs
VG #PV #LV #SN Attr VSize VFree
test1VG 1 4 0 wz--n- 1020.00m 36.00m
testingextentvg 1 1 0 wz--n- 104.00m 24.00m
vgexttest 1 1 0 wz--n- 96.00m 32.00m
Following command will create Logical volume swaphello with the size 10 MB
[root@kumar ~]# lvcreate -L 10M -n swaphello test1VG
[root@kumar ~]# mkswap /dev/mapper/test1VG-swaphello
[root@kumar ~]# swapon /dev/mapper/test1VG-swaphello
Add swap entry in the fstab so that it will be persistent
[root@kumar ~]# vi /etc/fstab
/dev/mapper/test1VG-swaphello swap swap defaults 0 0
Check your work
[root@kumar ~]# free -m
[root@kumar ~]# swapon -s
No comments:
Post a Comment