LVM Extend or Reduce Using e2fsck resize2fs lvextend lvreduce Command

After LVM creation if we need to extended or reduce we can do that using e2fsck, lvreduce,lvextend.
First we need to create Logical Volume Manager LVM CREATION TUTORIAL.

Logical Volume Extend & Logical Volume Reduce
1)LVM is created by layer by layer like
Physical Disk -> volume Group -> LVM - > File System.
2) So if we want to extend LVM.
First extend the Lvm then File system.
3)if we want to reduce the LVM.
First reduce the File system then LVM.
That is correct Format.

Logical Volume Extend
Logical Volume Reduce
Lvmextend - > resize2fs
Resize2fs -> lvreduce
Extend & Reduce we have to follow sequence.
Pvcreate
Vgcreate
Lvcreate
Pvs (report /Information)
Vgs
Lvs
Pvdisplay
Vgdisplay
Lvdisplay
Pvscan
Vgscan
Lvscan
Pvremove
Vgremove
Lvremove
Vgextend
Lvexend
Vgreduce
Lvreduce
ext2online
Resize ex2 file system (Used for RHEL Version 4 )
resize2fs
Resize ext2 & ext3 file system. ( but it is apply for ext4 also).
#System-config-lvm
Used to configure Logical volume
1)#mount    /dev/VOLUME_GROUP/LOGICAL_VOLUME /Mount-pt
How to mount the logical volume
Difference between RAID and LVM
RAID
LVM
1)Designed for storage,Data Backup , fault-tolerance(redundancy).
2)RAID is (storage technology) that combines multiple disk drive components into logical UNIT. In other words 
physical grouping of disk to create the logical representation of one disk.
1)Create & Extended  logical representation of the file system.
2)depends on the requirement to shrink or grow the file system.
Striping mirroring
stripping with parity.
 Check The File System
e2fsck comman is used to check the ext2 and ext3 file system.
This command is normally used when we reduce or extended file system. it will check the inodes, directory structure,
 directory connectivity, and Rerference counts.
-f it will check the filesyste with force.
[rhel5@bash /]# e2fsck -f /dev/vgo/lv0
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/vg1/data: 11/3072 files (9.1% non-contiguous), 1531/12288 blocks

Lvextend lvreduce Syntax
#[lvexted|lvreduce] -L [SIZE] [DEVICEPATH] 
 Resize2fs Syntax 
#resize2fs [PATH] [SIZE]
Vgextend Vgreduce Syntax
#[vgextend|vgreduce]  [volume_Group] [Device_Path]
Extend the Volume Group Logical Volume with New Disk
Create New Physical Partition
#fdisk /dev/sdb
Make the File system in ext3
#mkfs.ext3 /dev/sdb1
Create the physical Volume
#pvcreate /dev/sdb1
Extend the Volume Group
#vgextend VolGroup00 /dev/sdb1
After add the partition using vgdisplay and lvdisply check whether partition is added or not.
Extend the LVM with New Physical Volume
#lvextend /dev/vg1/lv0 /dev/sdb1
NOTE : Once we extend and reduce the lvm while mounting check the file system size using df -h. it will show the latest file system size, if it is still show the old one. reason is we need to initiate the e2fsck -f /device/path command and resize2fs once did that. it will update the latest file system utilization. Useful Links:

Post a Comment

0 Comments