How to reduce or shrink the size of lvm partitions

In my case I will shrink or reduce the /home size using lvreduce command. To reduce lvm size first umount the partition and run e2fsck & resize2fs.

 

Steps to reduce the /home partition to 5GB

 

Step:1 Check the disk space using below command

 

 

Umount /home using below command :

 

[root@localhost ~]# umount  /home

 

Step:2 Use e2fsck command to check the file system

 

[root@localhost ~]# e2fsck -f /dev/mapper/VolGroup-LogVol01

 

Step:3 Resize the partition using below command

 

 

Step:4 Use lvreduce command to reduce the size as shown below

 

 

Step:5 Mount and check the partition size

 

Published in: on January 31, 2013 at 8:51 am  Comments Off on How to reduce or shrink the size of lvm partitions  

How to extend or increase the size of LVM partitions

LVM  stands for Logical Volume Manager. One of the biggest advantage of lvm partitions is  that we can extend  file-system size using lvextend command.

 

I am taking the example of /home partition which is lvm based , currently /home is of 5GB , We will extend the size to 7GB , means we have to  add 2GB space.

 

Steps to Extend the size of /home by 2GB

 

Step:1 Check the space using below command

 

 

Step:2  After extending the size of /home by 2GB, it should be 7GB.

 

Umount /home partition using below command

 

[root@localhost ~]# umount /home/

 

Step:3 Use e2fsck command to check the file system as shown below

 

 

Step:4 Use resize2fs to resize the ext2,ext3 & ext4 file system

 

 

Now Mount /home using mount command and check the space using df command

 

 

Note : lvextend uses free space of the volume group for extending the size.To check the free size of volume group use vgs or vgdisplay command.

Published in: on January 31, 2013 at 8:47 am  Comments Off on How to extend or increase the size of LVM partitions