Posted by : Redhat 1 Thursday, January 7, 2016

                                      about LVM

what is lvm:----Lvm mean logical volume manager

u Logical Volume Manager (LVM) is a device mapper target that provides a more flexible way to manage disk space than  physical disk partition
          Why we use lvm
u Some of your partition filled up you want to expand it
u You want to shirnk your partition
u Add one or more disk/device
u You want to take backup of your file system/partition while you are still using it

lvm configuration------------------



                                                   create lvm---


1. Let's assume we have three new hard drives /dev/sda, /dev/sdb, /dev/sdc
2. First we need to create the physical volumes
pvcreate /dev/sda /dev/sdb [ /dev/sdc is left to extend the physical volume later]
pvdisplay
3. Now we need to create the logical volume group
vgcreate name-of-the-group /dev/sda /dev/sdb
Example: vgcreate vg1 /dev/sda /dev/sdb
vgdisplay
4. lvcreate -n lv1 -L 1G vg1
lvdisplay
5. mkfs.ext4 /dev/vg1/lv1
6. mkdir /lvolume1 [to mount the logical volume lv1 create a directory]
7. vim /etc/fstab
/dev/vg1/lv1 /lvolume1 ext4 defaults 0 0
or /dev/mapper/vg1-lv1 /lvolume1 ext4 defaults 0 0
8. mount -a
9. reboot

Extend LVM
==========

Situations of extending LVM

a. The logical volume is out of space => Extend the logical volume.
b. The logical volume and the volume group both are out of space => Extend the volume group by adding new physical volume.


1. To extend volume group
i. Add a new hard drive or create a new partition
ii. pvcreate /dev/sdc [ assuming your new drive is sdc]
iii. pvscan or pvdisplay [ optional]
iv. vgextend volume-group-name /dev/sdc
Example: vgextend vg1 /dev/sdc [ assuming your volume group is vg1 and partition is sdc]
v. vgscan
2. To extend logical volume [ umount /lvolume1  (assuming that you have mounted the logical volume at /lvolume1)]
i. lvextend -L +1G /dev/vg1/lv1
ii. resize2fs -p /dev/vg1/lv1
iii. mount -a




                           https://www.youtube.com/watch?v=1StGzqQcEEo

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Welcome to My Blog

Popular Post

Facebook Page

- Copyright © Configuretion Redhat -Robotic Notes- Powered by Blogger - Designed by bdnet -