Linux LVM (Logical Volume Manager)
The Logical Volume Manager (LVM) enables you to resize your partitions without having to modify the partition tables on your hard disk.Note : First you have to partition disk (fdisk) supported with Linux LVM(8e) then continue with following LVM configuration steps.
Physical Volume
A physical volume (PV) is another name for a regular physical disk partition that is used or will be used by LVM.Use the pvcreate command to create physical volumes.
# pvcreate /dev/sdb1
or # pvcreate /dev/sdb{2,3,4}
The pvdisplay command displays all physical volumes on your system.
# pvdisplay
or# pvdisplay /dev/sdb1
Volume groupa pool of storage that consists of one or more physical volumes(PV’s).#vgcreate /dev/vg0 /dev/sdb{2.3}
#vgcreate myvg /dev/sdb2 /dev/sdb3
Add/remove physical volumes to a virtual group
#pvcreate /dev/hdc
#vgextend mynew_vg /dev/sdb2
#vgreduce mynew_vg /dev/sdb2
#vgdisplay# lvcreate -l 212 lvm-hde -n lvm0
or# lvcreate -l 50%VG -n lvm0 lvm-hde
or#lvcreate –L 10M –n lv0 /dev/vg0Note : Actually here we create only 10MB of LV but its taking 12MB ..why? the reason is I mention PV is building blocks for LVM and minimum size of PV is 4MB so whenever you create LV it will be multiples of 4. That’s the reason 2MB got increased.
#lvdisplay
Chk lvsize: 12MB
#mke2fs –j /dev/vg0/lv0
#mount /dev/vg0/lv0 /mnt
Extend LV’s
lvextend -L +800 /dev/mynew_vg/vol01The command above does not actually increase the physical size of volume, to do that you need to:
resize2fs /dev/mynew_vg/vol01
Remove LV’s
#lvdisplay
# lvremove /dev/mynew_vg/vol02
Features |
LVM1
|
LVM2
|
RHEL AS 2.1 support | No | No |
RHEL 3 support | Yes | No |
RHEL 4 support | No | Yes |
Transactional metadata for fast recovery | No | Yes |
Shared volume mounts with GFS | No | Yes |
Cluster Suite failover supported | Yes | Yes |
Striped volume expansion | No | Yes |
Max number PVs, LVs | 256 PVs, 256 LVs | 2**32 PVs, 2**32 LVs |
Max device size | 2 Terabytes | 8 Exabytes (64-bit CPUs) |
Volume mirroring support | No | Yes, in Fall 2005 |