LVM (LOGICAL VOLUME MANAGER)

TO CREATE LVM
Step 1.fdisk /dev/sda   ->create 3 partitions + label to 8e
Step 2.partprobe
Step 3.fdisk -l
Step 4.pvcreate /dev/sda8 /dev/sda9
Step 5.pvdisplay /dev/sda8
Step 6.pvdisplay /dev/sda9
Step 7.vgcreate vg0 /dev/sda8 /dev/sda9
Step 8.vgdisplay
Step 9.lvcreate -L +200M -n /dev/vg0/home1
Step 10.lvdisplay /dev/vg0/home1
Step 11.lvcreate -L +300M -n /dev/vg0/var1
Step 12.lvdisplay /dev/vg0/var1
Step 13.mkfs.ext3 /dev/vg0/var1
Step 14 mkfs.ext3 /dev/vg0/home1
Step 15.mkdir /home1
Step 16.mkdir /var1
Step 17.mount /dev/vg0/home1 /home1
Step 18.mount /dev/vg0/var1 /var1
Step 19.cp /etc/a* /home1
Step 20.cp /etc/b* /var1
Step 21.vim /etc/fstab
Step 22.mount -a



TO EXTEND LVM (Adding 200M)
Step 1.lvdisplay /dev/vg0/home1
Step 2.lvextend -L +200M /dev/vg0/home1
Step 3.ls /home1
Step 4.resize2fs /dev/vg0/home1
Step 5.ls /home1


TO REDUCE LVM (Reducing to 100M)
Step 1. lvdisplay
Step 2. umount /var1
Step 3. e2fsck -f /dev/vg0/var1
Step 4. resize2fs /dev/vg0/var1 100M
Step 5. lvreduce -L 100M /dev/vg0/var1
Step 6. mount /dev/vg0/var1 /var1
Step 7. df -h


LVM SNAPSHOT
Step 1.  lvcreate  -L 200M -s -n lv2 /dev/llc/lv1


TO EXTEND PV
Step 1.pvcreate /dev/sda10
Step 2.pvdisplay


TO EXTEND VG
Step 1.vgextend vg0 /dev/sda10
Step 2.vgdisplay vg0


TO REDUCE VG
Step 1.vgreduce vg0 /dev/sda10
Step 2.vgdisplay


TO REDUCE PV
Step 1.pvremove /dev/sda10
Step 2.pvdisplay


REMOVE LVM
Step 1.lvdisplay
Step 2.umount /dev/vg0/home1
Step 3.umount /dev/vg0/var1
Step 4.vim /etc/fstab
Step 5.lvremove /dev/vg0/home1
Step 6.lvremove /dev/vg0/var1
Step 7.lvdisplay


REMOVE VG
Step 1.vgdisplay
Step 2.vgremove /dev/vg0
Step 3.vgdisplay


REMOVE PV
Step 1.pvdisplay
Step 2.pvremove /dev/sda9
Step 3.pvremove /dev/sda8