What is LVM ? How to create LVM Partition ?
LOGICAL VOLUME MANAGEMENT:
LVM(Logical Volume Management)
MBR
Partition
|
P
Sda1
|
P
Sda2
|
P
Sda3
|
P
Sda4
|
M
B
R
|
P1
Sda1
|
P2
Sda2
|
P3
Sda3
|
Extended
Partition (sda4)
Logical
Partitions are sub partition of Extended Partition.
|
||||||||||
L1
Sda5
|
L2
Sda6
|
L3
Sda7
|
L4
Sda8
|
L5
Sda9
|
L6
Sda10
|
L7
Sda11
|
L8
12
|
L9
(13)
|
L10
(14)
|
L11
Sda
(15)
|
Primary Physical Partition = 4
Physical Partition : (3P+1E) = 4
Physical + Logical Partition = (3P+1E)
+ (11L) = 15 Partition .
How to use LVM:
|
P
|
P
|
P
|
LVM
(50G)
|
PV
|
Physical Valume
VG
|
Volume Group
LV1 …N
|
Logical Volume Group
|
P
|
P
|
P
|
LVM (50G)
|
|
P
|
P
|
P
|
LVM (50G)
|
PV
|
PV
|
VG
|
Lv01 … Lv0N
|
M
B
R
|
P
|
P
|
P
|
Extended Partition
|
||
LVM
|
LVM
|
LVM
|
PV
|
||
PV
|
||
PV
|
VG
|
HOW TO CREATE PV,VG AND LV: `````````````````````````` 1. CREATE A PARTITION AND MARK IT AS LVM 2. CREATE A PHYSICAL VOLUME FROM ABOVE PARTITION pvcreate /dev/sda5 3. CREATE VOLUME GROUP FROM THE PHYSICAL VOLUME vgcreate VGUCLID /dev/sda5 4. create LOGICAL VOLUMES syn: lvcreate -n <lvname> [-l <size_in_extents> | -L <size> <vgname> ex: lvcreate -n lv01 -L 1G VGUCLID 5. format the partition and mount it # mkfs.ext4 /dev/VGUCLID/lv01 # mkdir /lvm1 # mount /dev/VGUCLID/lv01 /lvm1 how to extend LV size: 1. lvextend -L +1G /dev/VGUCLID/lv01 2. resize2fs /dev/VGUCLID/lv01 how to reduce LV size: 1. unmount the partition 2. check the file system e2fsck -f /dev/VGUCLID/lv01 3. resize the file system resize2fs /dev/VGUCLID/lv01 1G 4. lvreduce -L 1G /dev/VGUCLID/lv01 5. mount the partition how to extend Volume Group: 1. create a partition usinf fdisk and mark it as LVM 2. create a physical volume from above partition pvcreate /dev/sda6 3. extend the Volume Group vgextend VGUCLID /dev/sda6 6.Taking a snapshort (backup) of logical valume: step1 :lvcreate -s -n lv01_bkp -L 1G /dev/vgvedic/lv01 Recovery of backup: step 1: unmount the partition unmount /dev/vgvedic/lv01 step2: lvconvert --merge /dev/vgvedic/lv01_bkp step 3: mount /dev/vgvedic/lv01 /u01 step 3: mount /dev/vgvedic/lv01 /u01
Comments
Post a Comment