Home » Linux » How to resize LVM (extend or reduce)

How to resize LVM (extend or reduce)

Logical Volume Manager is great, you can manage your disks and partitions in volumes. The most common task is to extend a volume or reduce one.

You can extend a volume while the system is running, which is preaty great. Here�s how:

1. Let say your physical disk is /dev/sda, you already have two partitions (/dev/sda1 and /dev/sda2) and want to extend the rest of the free space. fdisk /dev/sda and create a new partition /dev/sda3

2.� pvcreate /dev/sda3

3.��vgextend VolGroup00 /dev/sda3

4.�� lvextend /dev/VolGroup00/LogVol00 /dev/sda3

5.�� resize2fs /dev/VolGroup00/LogVol00

Now, asume that we want to reduce. This is a little bit tricky, you can not do it on the fly. You have to boot with a rescue cd (can be CentOS cd1 and type linux rescue at prompt).

1. lvm vgchange -a y

2. e2fsck -f /dev/VolGroup00/LogVol00

3. resize2fs -f /dev/VolGroup00/LogVol00 20G

4. lvm lvreduce -L10G /dev/VolGroup00/LogVol00

Happy resizing !

Leave a Reply

Your email address will not be published. Required fields are marked *